Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/user_saml.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2018-07-11 13:22:45 +0300
committerBjoern Schiessle <bjoern@schiessle.org>2018-08-03 13:43:19 +0300
commit20757e9f0eafef2cbbbb7e37057609209e1a878c (patch)
tree768d2787c4f8c933fbba118be330411b8b58d049 /lib/SAMLSettings.php
parentdafaf016a6fbde275120547c1696f71b57383cff (diff)
make sure to always use the right idp config
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib/SAMLSettings.php')
-rw-r--r--lib/SAMLSettings.php33
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/SAMLSettings.php b/lib/SAMLSettings.php
index 0f97b634..3e287eab 100644
--- a/lib/SAMLSettings.php
+++ b/lib/SAMLSettings.php
@@ -24,6 +24,7 @@ namespace OCA\User_SAML;
use OCP\AppFramework\Http;
use OCP\IConfig;
use OCP\IRequest;
+use OCP\ISession;
use OCP\IURLGenerator;
class SAMLSettings {
@@ -33,18 +34,25 @@ class SAMLSettings {
private $config;
/** @var IRequest */
private $request;
+ /** @var ISession */
+ private $session;
+ /** @var array list of global settings which are valid for every idp */
+ private $globalSettings = ['general-require_provisioned_account', 'general-allow_multiple_user_back_ends', 'general-use_saml_auth_for_desktop'];
/**
* @param IURLGenerator $urlGenerator
* @param IConfig $config
* @param IRequest $request
+ * @param ISession $session
*/
public function __construct(IURLGenerator $urlGenerator,
IConfig $config,
- IRequest $request) {
+ IRequest $request,
+ ISession $session) {
$this->urlGenerator = $urlGenerator;
$this->config = $config;
$this->request = $request;
+ $this->session = $session;
}
/**
@@ -148,5 +156,26 @@ class SAMLSettings {
return $settings;
}
-}
+ /**
+ * calculate prefix for config values
+ *
+ * @param string name of the setting
+ * @return string
+ */
+ public function getPrefix($setting = '') {
+
+ $prefix = '';
+ if (!empty($setting) && in_array($setting, $this->globalSettings)) {
+ return $prefix;
+ }
+
+ $idp = $this->session->get('user_saml.Idp');
+ if ((int)$idp > 1) {
+ $prefix = $idp . '-';
+ }
+
+ return $prefix;
+ }
+
+}