diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-11 13:22:45 +0300 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2018-08-03 13:43:19 +0300 |
commit | 20757e9f0eafef2cbbbb7e37057609209e1a878c (patch) | |
tree | 768d2787c4f8c933fbba118be330411b8b58d049 /lib/UserBackend.php | |
parent | dafaf016a6fbde275120547c1696f71b57383cff (diff) |
make sure to always use the right idp config
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib/UserBackend.php')
-rw-r--r-- | lib/UserBackend.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/UserBackend.php b/lib/UserBackend.php index fd5df33f..7b8b1f3d 100644 --- a/lib/UserBackend.php +++ b/lib/UserBackend.php @@ -48,6 +48,8 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend { private $groupManager; /** @var \OCP\UserInterface[] */ private static $backends = []; + /** @var SAMLSettings */ + private $settings; /** * @param IConfig $config @@ -56,19 +58,22 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend { * @param IDBConnection $db * @param IUserManager $userManager * @param IGroupManager $groupManager + * @param SAMLSettings $settings */ public function __construct(IConfig $config, IURLGenerator $urlGenerator, ISession $session, IDBConnection $db, IUserManager $userManager, - IGroupManager $groupManager) { + IGroupManager $groupManager, + SAMLSettings $settings) { $this->config = $config; $this->urlGenerator = $urlGenerator; $this->session = $session; $this->db = $db; $this->userManager = $userManager; $this->groupManager = $groupManager; + $this->settings = $settings; } /** @@ -344,7 +349,8 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend { * {@inheritdoc} */ public function getLogoutUrl() { - $slo = $this->config->getAppValue('user_saml', 'idp-singleLogoutService.url', ''); + $prefix = $this->settings->getPrefix(); + $slo = $this->config->getAppValue('user_saml', $prefix . 'idp-singleLogoutService.url', ''); if($slo === '') { return ''; } @@ -373,7 +379,8 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend { */ public function getCurrentUserId() { $samlData = $this->session->get('user_saml.samlUserData'); - $uidMapping = $this->config->getAppValue('user_saml', 'general-uid_mapping', ''); + $prefix = $this->settings->getPrefix(); + $uidMapping = $this->config->getAppValue('user_saml', $prefix . 'general-uid_mapping', ''); if($uidMapping !== '' && isset($samlData[$uidMapping])) { if(is_array($samlData[$uidMapping])) { @@ -437,7 +444,8 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend { private function getAttributeKeys($name) { - $keys = explode(' ', $this->config->getAppValue('user_saml', $name, '')); + $prefix = $this->settings->getPrefix($name); + $keys = explode(' ', $this->config->getAppValue('user_saml', $prefix . $name, '')); if (count($keys) === 1 && $keys[0] === '') { throw new \InvalidArgumentException('Attribute is not configured'); |