diff --git a/lib/SimpleSAML/Auth/TimeLimitedToken.php b/lib/SimpleSAML/Auth/TimeLimitedToken.php index 95d4a22d64ca332064653927b83194eb73e1e4d9..3c991ce946c1a6b6391f0d5d599733f6b40fb4a0 100644 --- a/lib/SimpleSAML/Auth/TimeLimitedToken.php +++ b/lib/SimpleSAML/Auth/TimeLimitedToken.php @@ -14,8 +14,7 @@ class SimpleSAML_Auth_TimeLimitedToken { */ public function __construct( $lifetime = 900, $secretSalt = NULL, $skew = 1) { if ($secretSalt === NULL) { - $config = SimpleSAML_Configuration::getInstance(); - $secretSalt = $config->getValue('secretsalt'); + $secretSalt = SimpleSAML_Utilities::getSecretSalt(); } $this->secretSalt = $secretSalt; diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php index 68a0051eb162b061b9f3e9a33db272fe6f849e36..c4554749c9940d072676a5482b5cd62629bbde2d 100644 --- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php +++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php @@ -83,7 +83,7 @@ class SimpleSAML_Bindings_Shib13_HTTPPost { $response = $responsedom->saveXML(); - if ($this->configuration->getValue('debug')) { + if ($this->configuration->getBoolean('debug', FALSE)) { $p = new SimpleSAML_XHTML_Template($this->configuration, 'post-debug.php'); $p->data['header'] = 'SAML (Shibboleth 1.3) Response Debug-mode'; $p->data['RelayStateName'] = 'TARGET'; diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index 487905ec9ce52e0c6b1d73d0ae97d040118d78e4..c812e0e25ea42505cb9d886a75daf67956db57ef 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -296,10 +296,11 @@ class SimpleSAML_Configuration { public function getBaseURL() { - if (preg_match('/^\*(.*)$/', $this->getValue('baseurlpath', ''), $matches)) { + if (preg_match('/^\*(.*)$/', $this->getString('baseurlpath', 'simplesaml/'), $matches)) { return SimpleSAML_Utilities::getFirstPathElement(false) . $matches[1]; } - return $this->getValue('baseurlpath', ''); + + return $this->getString('baseurlpath', 'simplesaml/'); } @@ -375,7 +376,7 @@ class SimpleSAML_Configuration { /* Check if a directory is configured in the configuration * file. */ - $dir = $this->getValue('basedir'); + $dir = $this->getString('basedir', NULL); if($dir !== NULL) { /* Add trailing slash if it is missing. */ if(substr($dir, -1) !== '/') { diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php index 6b1ff431c6a92de08d4d05553e668b71e28f8003..4a66f47f50efc0645be7d24f2570cacdab0b0ca8 100644 --- a/lib/SimpleSAML/Logger.php +++ b/lib/SimpleSAML/Logger.php @@ -119,7 +119,7 @@ class SimpleSAML_Logger { /* * setting minimum log_level */ - self::$logLevel = $config->getValue('logging.level',LOG_INFO); + self::$logLevel = $config->getInteger('logging.level',LOG_INFO); $handler = strtolower($handler); diff --git a/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php b/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php index 0a9bddbff31233b1ad8770d9290d614c75a55d7a..7b50c488bbe02db5cef4a78405e155957a2c7db9 100644 --- a/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php +++ b/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php @@ -29,7 +29,7 @@ class SimpleSAML_Logger_LoggingHandlerErrorLog implements SimpleSAML_Logger_Logg function log_internal($level, $string) { $config = SimpleSAML_Configuration::getInstance(); assert($config instanceof SimpleSAML_Configuration); - $processname = $config->getValue('logging.processname','simpleSAMLphp'); + $processname = $config->getString('logging.processname','simpleSAMLphp'); if(array_key_exists($level, self::$levelNames)) { $levelName = self::$levelNames[$level]; diff --git a/lib/SimpleSAML/Logger/LoggingHandlerFile.php b/lib/SimpleSAML/Logger/LoggingHandlerFile.php index f84d628117cea0f59a2ee846f35b02896c102fe0..41198a063be8351895a0714113400b80ea37f1ea 100644 --- a/lib/SimpleSAML/Logger/LoggingHandlerFile.php +++ b/lib/SimpleSAML/Logger/LoggingHandlerFile.php @@ -34,8 +34,8 @@ class SimpleSAML_Logger_LoggingHandlerFile implements SimpleSAML_Logger_LoggingH assert($config instanceof SimpleSAML_Configuration); /* Get the metadata handler option from the configuration. */ - $this->logFile = $config->getPathValue('loggingdir').$config->getValue('logging.logfile'); - $this->processname = $config->getValue('logging.processname','simpleSAMLphp'); + $this->logFile = $config->getPathValue('loggingdir', 'log/').$config->getString('logging.logfile', 'simplesamlphp.log'); + $this->processname = $config->getString('logging.processname','simpleSAMLphp'); if (@file_exists($this->logFile)) { if (!@is_writeable($this->logFile)) throw new Exception("Could not write to logfile: ".$this->logFile); diff --git a/lib/SimpleSAML/Logger/LoggingHandlerSyslog.php b/lib/SimpleSAML/Logger/LoggingHandlerSyslog.php index 2e8dcbb5e3ae3620bd98af9a1f4ca0f6aa284136..562ca12133ccb0aea7806cf3ae528c8aed1b4354 100644 --- a/lib/SimpleSAML/Logger/LoggingHandlerSyslog.php +++ b/lib/SimpleSAML/Logger/LoggingHandlerSyslog.php @@ -16,9 +16,9 @@ class SimpleSAML_Logger_LoggingHandlerSyslog implements SimpleSAML_Logger_Loggin function __construct() { $config = SimpleSAML_Configuration::getInstance(); assert($config instanceof SimpleSAML_Configuration); - $facility = $config->getValue('logging.facility'); + $facility = $config->getInteger('logging.facility', defined('LOG_LOCAL5') ? constant('LOG_LOCAL5') : LOG_USER); - $processname = $config->getValue('logging.processname','simpleSAMLphp'); + $processname = $config->getString('logging.processname','simpleSAMLphp'); /* * OS Check * Setting facility to LOG_USER (only valid in Windows), enable log level rewrite on windows systems. diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php index eb088b28d3d7a02a78da79b267c2a2b9ee443bb3..7d39cc8103af1dcad6c333d1e25da7ec4af9a712 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php @@ -49,21 +49,14 @@ class SimpleSAML_Metadata_MetaDataStorageHandler { $config = SimpleSAML_Configuration::getInstance(); - $sourcesConfig = $config->getValue('metadata.sources', NULL); + $sourcesConfig = $config->getArray('metadata.sources', NULL); /* For backwards compatibility, and to provide a default configuration. */ if($sourcesConfig === NULL) { - $type = $config->getValue('metadata.handler', 'flatfile'); + $type = $config->getString('metadata.handler', 'flatfile'); $sourcesConfig = array(array('type' => $type)); } - if(!is_array($sourcesConfig)) { - throw new Exception( - 'Invalid configuration of the \'metadata.sources\' configuration option.' . - ' This option should be an array.' - ); - } - try { $this->sources = SimpleSAML_Metadata_MetaDataStorageSource::parseSources($sourcesConfig); } catch (Exception $e) { diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php index a220043b8254719f28863911947c343ebd497206..6c33ec42fc7c135b5bb20852f9cdeed2cc8569dd 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php @@ -55,7 +55,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerFlatFile extends SimpleSAML_Meta if(array_key_exists('directory', $config)) { $this->directory = $config['directory']; } else { - $this->directory = $globalConfig->getValue('metadatadir', 'metadata/'); + $this->directory = $globalConfig->getString('metadatadir', 'metadata/'); } /* Resolve this directory relative to the simpleSAMLphp directory (unless it is diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php index 6b6f03218ac7bcda4e3883c00fd8118da05a3065..fe352e72eb3608061d7a529b94282cabc40e0a7a 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSAML2Meta.php @@ -58,7 +58,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSAML2Meta extends SimpleSAML_Met // The metadata location is an URL $metadatasetfile = $metadatalocation; } else { - $metadatasetfile = $config->getPathValue('metadatadir') . $metadatalocation; + $metadatasetfile = $config->getPathValue('metadatadir', 'metadata/') . $metadatalocation; if (!file_exists($metadatasetfile)) throw new Exception('Could not find SAML 2.0 Metadata file :'. $metadatasetfile); if (preg_match('@\.php$@', $metadatalocation)) { $xml = false; diff --git a/lib/SimpleSAML/Metadata/Signer.php b/lib/SimpleSAML/Metadata/Signer.php index 8d433aea0bb151bede58e9afbbbd0426198eb623..bd81709f2b23aa9af9f8e30bd0b979cd6c12a0ab 100644 --- a/lib/SimpleSAML/Metadata/Signer.php +++ b/lib/SimpleSAML/Metadata/Signer.php @@ -46,8 +46,8 @@ class SimpleSAML_Metadata_Signer { } /* Then we look for default values in the global configuration. */ - $privatekey = $config->getValue('metadata.sign.privatekey', NULL); - $certificate = $config->getValue('metadata.sign.certificate', NULL); + $privatekey = $config->getString('metadata.sign.privatekey', NULL); + $certificate = $config->getString('metadata.sign.certificate', NULL); if($privatekey !== NULL || $certificate !== NULL) { if($privatekey === NULL || $certificate === NULL) { throw new Exception('Missing either the "metadata.sign.privatekey" or the' . @@ -57,7 +57,7 @@ class SimpleSAML_Metadata_Signer { } $ret = array('privatekey' => $privatekey, 'certificate' => $certificate); - $privatekey_pass = $config->getValue('metadata.sign.privatekey_pass', NULL); + $privatekey_pass = $config->getString('metadata.sign.privatekey_pass', NULL); if($privatekey_pass !== NULL) { $ret['privatekey_pass'] = $privatekey_pass; } @@ -115,11 +115,7 @@ class SimpleSAML_Metadata_Signer { return $entityMetadata['metadata.sign.enable']; } - $enabled = $config->getValue('metadata.sign.enable', FALSE); - if(!is_bool($enabled)) { - throw new Exception('Invalid value for the "metadata.sign.enable" configuration option.' . - ' This option should be a boolean.'); - } + $enabled = $config->getBoolean('metadata.sign.enable', FALSE); return $enabled; } @@ -147,13 +143,13 @@ class SimpleSAML_Metadata_Signer { $keyCertFiles = self::findKeyCert($config, $entityMetadata, $type); - $keyFile = $config->getPathValue('certdir') . $keyCertFiles['privatekey']; + $keyFile = $config->getPathValue('certdir', 'cert/') . $keyCertFiles['privatekey']; if (!file_exists($keyFile)) { throw new Exception('Could not find private key file [' . $keyFile . '], which is needed to sign the metadata'); } $keyData = file_get_contents($keyFile); - $certFile = $config->getPathValue('certdir') . $keyCertFiles['certificate']; + $certFile = $config->getPathValue('certdir', 'cert/') . $keyCertFiles['certificate']; if (!file_exists($certFile)) { throw new Exception('Could not find certificate file [' . $certFile . '], which is needed to sign the metadata'); } diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index 025a9d6ec106c6b8220612f21971e68c7291dec2..5d8c19af0e8f7ab7cda1e69b4e9c3a61aed36ecd 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -95,7 +95,7 @@ class SimpleSAML_Session { private function __construct() { $configuration = SimpleSAML_Configuration::getInstance(); - $this->sessionduration = $configuration->getValue('session.duration'); + $this->sessionduration = $configuration->getInteger('session.duration', 8*60*60); $this->trackid = SimpleSAML_Utilities::generateTrackID(); @@ -736,16 +736,16 @@ class SimpleSAML_Session { $configuration = SimpleSAML_Configuration::getInstance(); - $timeout = $configuration->getValue('session.datastore.timeout', NULL); + $timeout = $configuration->getInteger('session.datastore.timeout', NULL); if($timeout !== NULL) { - if(!is_int($timeout) || $timeout <= 0) { + if ($timeout <= 0) { throw new Exception('The value of the session.datastore.timeout' . ' configuration option should be a positive integer.'); } } else { /* For backwards compatibility. */ - $timeout = $configuration->getValue('session.requestcache', 4*(60*60)); - if(!is_int($timeout) || $timeout <= 0) { + $timeout = $configuration->getInteger('session.requestcache', 4*(60*60)); + if ($timeout <= 0) { throw new Exception('The value of the session.requestcache' . ' configuration option should be a positive integer.'); } diff --git a/lib/SimpleSAML/SessionHandlerPHP.php b/lib/SimpleSAML/SessionHandlerPHP.php index 6c4a102c7f74d6db84808b855bd3188958213608..6a2eae69b4c46c72b4cb78d3bc946510fabc23a3 100644 --- a/lib/SimpleSAML/SessionHandlerPHP.php +++ b/lib/SimpleSAML/SessionHandlerPHP.php @@ -33,13 +33,13 @@ class SimpleSAML_SessionHandlerPHP extends SimpleSAML_SessionHandler { if(session_id() === '') { $config = SimpleSAML_Configuration::getInstance(); - $cookiepath = ($config->getValue('session.phpsession.limitedpath', FALSE) ? '/' . $config->getValue('baseurlpath') : '/'); + $cookiepath = ($config->getBoolean('session.phpsession.limitedpath', FALSE) ? '/' . $config->getBaseURL() : '/'); session_set_cookie_params(0, $cookiepath, NULL, SimpleSAML_Utilities::isHTTPS()); - $cookiename = $config->getValue('session.phpsession.cookiename', NULL); + $cookiename = $config->getString('session.phpsession.cookiename', NULL); if (!empty($cookiename)) session_name($cookiename); - $savepath = $config->getValue('session.phpsession.savepath', NULL); + $savepath = $config->getString('session.phpsession.savepath', NULL); if(!empty($savepath)) { session_save_path($savepath); } diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 931faacd7f069eac3cb94e1b7f4f344f778b577d..a38c1a289615e70f7b98be799729649d9f7afc70 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -556,10 +556,10 @@ class SimpleSAML_Utilities { $t->data['errorcode'] = $errorcode; $t->data['parameters'] = $parameters; - $t->data['showerrors'] = $config->getValue('showerrors', true); + $t->data['showerrors'] = $config->getBoolean('showerrors', true); /* Check if there is a valid technical contact email address. */ - if($config->getValue('technicalcontact_email', 'na@example.org') !== 'na@example.org') { + if($config->getString('technicalcontact_email', 'na@example.org') !== 'na@example.org') { /* Enable error reporting. */ $baseurl = SimpleSAML_Utilities::selfURLhost() . '/' . $config->getBaseURL(); $t->data['errorreportaddress'] = $baseurl . 'errorreport.php'; @@ -583,7 +583,7 @@ class SimpleSAML_Utilities { $t->data['trackid'] = $trackid; - $t->data['version'] = $config->getValue('version', 'na'); + $t->data['version'] = $config->getString('version', 'na'); $t->data['url'] = self::selfURLNoQuery(); $t->show(); @@ -1005,18 +1005,13 @@ class SimpleSAML_Utilities { throw new Exception('XML contained a doctype declaration.'); } - $enabled = SimpleSAML_Configuration::getInstance()->getValue('debug.validatexml', NULL); + $enabled = SimpleSAML_Configuration::getInstance()->getBoolean('debug.validatexml', NULL); if($enabled === NULL) { /* Fall back to old configuration option. */ - $enabled = SimpleSAML_Configuration::getInstance()->getValue('debug.validatesamlmessages', NULL); + $enabled = SimpleSAML_Configuration::getInstance()->getBoolean('debug.validatesamlmessages', NULL); if($enabled === NULL) { /* Fall back to even older configuration option. */ - $enabled = SimpleSAML_Configuration::getInstance()->getValue('debug.validatesaml2messages', FALSE); - if(!is_bool($enabled)) { - throw new Exception('Expected "debug.validatesaml2messages" to be set to a boolean value.'); - } - } elseif(!is_bool($enabled)) { - throw new Exception('Expected "debug.validatexml" to be set to a boolean value.'); + $enabled = SimpleSAML_Configuration::getInstance()->getBoolean('debug.validatesaml2messages', FALSE); } } @@ -1468,7 +1463,7 @@ class SimpleSAML_Utilities { } elseif (array_key_exists($prefix . 'certificate', $metadata)) { /* Reference to certificate file. */ $config = SimpleSAML_Configuration::getInstance(); - $file = $config->getPathValue('certdir') . $metadata[$prefix . 'certificate']; + $file = $config->getPathValue('certdir', 'cert/') . $metadata[$prefix . 'certificate']; $data = @file_get_contents($file); if ($data === FALSE) { throw new Exception('Unable to load certificate/public key from file "' . $file . '"'); @@ -1555,7 +1550,7 @@ class SimpleSAML_Utilities { } $config = SimpleSAML_Configuration::getInstance(); - $file = $config->getPathValue('certdir') . $metadata[$prefix . 'privatekey']; + $file = $config->getPathValue('certdir', 'cert/') . $metadata[$prefix . 'privatekey']; $data = @file_get_contents($file); if ($data === FALSE) { throw new Exception('Unable to load private key from file "' . $file . '"'); diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php index ff76dae69b367f4b2d6344c396836999a75c64f8..0bc2c38698c5814fb5324d182ad8f2d22364f301 100644 --- a/lib/SimpleSAML/XHTML/IdPDisco.php +++ b/lib/SimpleSAML/XHTML/IdPDisco.php @@ -399,8 +399,8 @@ class SimpleSAML_XHTML_IdPDisco { $idp = $this->getTargetIdp(); if($idp !== NULL) { - if ($this->config->getValue('idpdisco.extDiscoveryStorage', NULL) != NULL) { - $extDiscoveryStorage = $this->config->getValue('idpdisco.extDiscoveryStorage'); + if ($this->config->getBoolean('idpdisco.extDiscoveryStorage', NULL) != NULL) { + $extDiscoveryStorage = $this->config->getBoolean('idpdisco.extDiscoveryStorage'); $this->log('Choice made [' . $idp . '] (Forwarding to external discovery storage)'); SimpleSAML_Utilities::redirect($extDiscoveryStorage, array( // $this->returnIdParam => $idp, diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 2a948871bbd2578d3d9f30515f1d2c59572cab64..58b98d40c58bb4c96ab8d8c39624816ee46aeea6 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -123,7 +123,7 @@ class SimpleSAML_XHTML_Template { * languages in the header were available. */ private function getHTTPLanguage() { - $availableLanguages = $this->configuration->getValue('language.available'); + $availableLanguages = $this->configuration->getArray('language.available', array('en')); $languageScore = SimpleSAML_Utilities::getAcceptLanguage(); /* For now we only use the default language map. We may use a configurable language map @@ -172,14 +172,14 @@ class SimpleSAML_XHTML_Template { * Returns the language default (from configuration) */ private function getDefaultLanguage() { - return $this->configuration->getValue('language.default', 'en'); + return $this->configuration->getString('language.default', 'en'); } /** * Returns a list of all available languages. */ private function getLanguageList() { - $availableLanguages = $this->configuration->getValue('language.available'); + $availableLanguages = $this->configuration->getArray('language.available', array('en')); $thisLang = $this->getLanguage(); $lang = array(); foreach ($availableLanguages AS $nl) { @@ -221,7 +221,7 @@ class SimpleSAML_XHTML_Template { $fileName = substr($name, $sepPos + 1); $dictDir = SimpleSAML_Module::getModuleDir($module) . '/dictionaries/'; } else { - $dictDir = $this->configuration->getPathValue('dictionarydir'); + $dictDir = $this->configuration->getPathValue('dictionarydir', 'dictionaries/'); $fileName = $name; } $this->dictionaries[$name] = $this->readDictionaryFile($dictDir . $fileName . '.php'); @@ -418,9 +418,9 @@ class SimpleSAML_XHTML_Template { $filebase = null; if (!empty($otherConfig)) { - $filebase = $otherConfig->getPathValue('dictionarydir'); + $filebase = $otherConfig->getPathValue('dictionarydir', 'dictionaries/'); } else { - $filebase = $this->configuration->getPathValue('dictionarydir'); + $filebase = $this->configuration->getPathValue('dictionarydir', 'dictionaries/'); } @@ -493,7 +493,7 @@ class SimpleSAML_XHTML_Template { $templateName = $tmp[0]; } - $tmp = explode(':', $this->configuration->getValue('theme.use'), 2); + $tmp = explode(':', $this->configuration->getString('theme.use', 'default'), 2); if (count($tmp) === 2) { $themeModule = $tmp[0]; $themeName = $tmp[1]; @@ -515,7 +515,7 @@ class SimpleSAML_XHTML_Template { } else { /* .../templates/<theme>/<templateName> */ - $filename = $this->configuration->getPathValue('templatedir') . $templateName; + $filename = $this->configuration->getPathValue('templatedir', 'templates/') . $templateName; } if (file_exists($filename)) { @@ -529,14 +529,14 @@ class SimpleSAML_XHTML_Template { /* Try default theme. */ - $baseTheme = $this->configuration->getValue('theme.base'); + $baseTheme = $this->configuration->getString('theme.base', 'default'); if ($templateModule !== 'default') { /* .../module/<templateModule>/templates/<baseTheme>/<templateName> */ $filename = SimpleSAML_Module::getModuleDir($templateModule) . '/templates/' . $templateName; } else { /* .../templates/<baseTheme>/<templateName> */ - $filename = $this->configuration->getPathValue('templatedir') . '/' . $templateName; + $filename = $this->configuration->getPathValue('templatedir', 'templates/') . '/' . $templateName; } if (file_exists($filename)) { diff --git a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php index bac77ac1efa95dc220609761956aab2d831a45a5..e1b7c564fa9d505177902e44eee25d2e81fc42b3 100644 --- a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php +++ b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php @@ -50,7 +50,7 @@ class SimpleSAML_XML_Shib13_AuthnResponse extends SimpleSAML_XML_AuthnResponse { $this->validator->validateFingerprint($issuerFingerprint); } elseif(array_key_exists('caFile', $md)) { /* Validate against CA. */ - $this->validator->validateCA($this->configuration->getPathValue('certdir') . $md['caFile']); + $this->validator->validateCA($this->configuration->getPathValue('certdir', 'cert/') . $md['caFile']); } else { throw new Exception('Required field [certFingerprint] or [caFile] in Shibboleth 1.3 IdP Remote metadata was not found for identity provider [' . $issuer . ']. Please add a fingerprint and try again. You can add a dummy fingerprint first, and then an error message will be printed with the real fingerprint.'); } diff --git a/lib/SimpleSAML/XML/Signer.php b/lib/SimpleSAML/XML/Signer.php index efbf0d8efa77ed07b9337e6c026cfade1a50e403..f07f48b020ba169028e8f95a68080cb4da96d04c 100644 --- a/lib/SimpleSAML/XML/Signer.php +++ b/lib/SimpleSAML/XML/Signer.php @@ -60,7 +60,7 @@ class SimpleSAML_XML_Signer { if(self::$certDir === FALSE) { $config = SimpleSAML_Configuration::getInstance(); - self::$certDir = $config->getPathValue('certdir'); + self::$certDir = $config->getPathValue('certdir', 'cert/'); } $this->idAttrName = FALSE; diff --git a/modules/adfs/www/idp/prp.php b/modules/adfs/www/idp/prp.php index 4bdf238f272fd07eb92117e654f530007878831e..9f0cbb101ed1c82439aadb3344c2a42d6647b01b 100644 --- a/modules/adfs/www/idp/prp.php +++ b/modules/adfs/www/idp/prp.php @@ -259,7 +259,7 @@ if (!$session->isValid($authority) ) { } $response = ADFS_GenerateResponse($idpentityid, $spentityid, $nameid, $attributes); - $wresult = ADFS_SignResponse($response, $config->getPathValue('certdir') . $adfsconfig->getValue('key'), $config->getPathValue('certdir') . $adfsconfig->getValue('cert')); + $wresult = ADFS_SignResponse($response, $config->getPathValue('certdir', 'cert/') . $adfsconfig->getValue('key'), $config->getPathValue('certdir', 'cert/') . $adfsconfig->getValue('cert')); ADFS_PostResponse($spmetadata->getValue('prp'), $wresult, $relayState); diff --git a/modules/consentAdmin/www/consentAdmin.php b/modules/consentAdmin/www/consentAdmin.php index 9204d15fbe5f10548a79e20e27cc527536135cf6..a3457010ef335115427209d594f160b761546458 100644 --- a/modules/consentAdmin/www/consentAdmin.php +++ b/modules/consentAdmin/www/consentAdmin.php @@ -239,7 +239,7 @@ foreach ($all_sp_metadata as $sp_entityid => $sp_values) { $relaystate = $cA_config->getValue('relaystate'); $et->data['header'] = 'Consent Administration'; -$et->data['logout'] = '<p>[ <a href="/' . $config->getValue('baseurlpath') . 'saml2/sp/initSLO.php?RelayState='. $relaystate .'">Logout</a> ]'; +$et->data['logout'] = '<p>[ <a href="/' . $config->getBaseURL() . 'saml2/sp/initSLO.php?RelayState='. $relaystate .'">Logout</a> ]'; $et->data['spList'] = $sp_list; $et->show(); ?> diff --git a/modules/core/hooks/hook_sanitycheck.php b/modules/core/hooks/hook_sanitycheck.php index 9055801561f9d85550158a44969f707d58daf7e0..132e2ee26919f1a4fe576f26168cd8878b0298db 100644 --- a/modules/core/hooks/hook_sanitycheck.php +++ b/modules/core/hooks/hook_sanitycheck.php @@ -11,13 +11,13 @@ function core_hook_sanitycheck(&$hookinfo) { $config = SimpleSAML_Configuration::getInstance(); - if($config->getValue('auth.adminpassword', '123') === '123') { + if($config->getString('auth.adminpassword', '123') === '123') { $hookinfo['errors'][] = '[core] Password in config.php is not set properly'; } else { $hookinfo['info'][] = '[core] Password in config.php is set properly'; } - if($config->getValue('technicalcontact_email', 'na@example.org') === 'na@example.org') { + if($config->getString('technicalcontact_email', 'na@example.org') === 'na@example.org') { $hookinfo['errors'][] = '[core] In config.php technicalcontact_email is not set properly'; } else { $hookinfo['info'][] = '[core] In config.php technicalcontact_email is set properly'; diff --git a/modules/core/lib/Auth/Process/AttributeMap.php b/modules/core/lib/Auth/Process/AttributeMap.php index b9a8f31702f4de352bc694ab3afffb30178795ca..a2d0ac26a99fac3d91008893642526c19b4b81be 100644 --- a/modules/core/lib/Auth/Process/AttributeMap.php +++ b/modules/core/lib/Auth/Process/AttributeMap.php @@ -53,7 +53,7 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi */ private function loadMapFile($fileName) { $config = SimpleSAML_Configuration::getInstance(); - $filePath = $config->getPathValue('attributenamemapdir') . $fileName . '.php'; + $filePath = $config->getPathValue('attributenamemapdir', 'attributemap/') . $fileName . '.php'; if(!file_exists($filePath)) { throw new Exception('Could not find attributemap file: ' . $filePath); diff --git a/modules/cron/www/cron.php b/modules/cron/www/cron.php index 38076c58eb7b186a33e05fb66fab46ea2c25c997..052757a136681dce64fdf771e5b3824189681cd9 100644 --- a/modules/cron/www/cron.php +++ b/modules/cron/www/cron.php @@ -39,7 +39,7 @@ if ($cronconfig->getValue('sendemail', TRUE) && count($summary) > 0) { '<p>URL: <tt>' . SimpleSAML_Utilities::selfURL() . '</tt></p>' . '<p>Tag: ' . $_REQUEST['tag'] . "</p>\n\n" . $statustext; - $toaddress = $config->getValue('technicalcontact_email', 'na@example.org'); + $toaddress = $config->getString('technicalcontact_email', 'na@example.org'); if($toaddress == 'na@example.org') { SimpleSAML_Logger::error('Cron - Could not send email. [technicalcontact_email] not set in config.'); } else { diff --git a/modules/discopower/lib/PowerIdPDisco.php b/modules/discopower/lib/PowerIdPDisco.php index ceb465c48b064ec67f7bc250646044e0c875e373..e49b134f6839b3cd54f6e9c90693a9b77892d6eb 100644 --- a/modules/discopower/lib/PowerIdPDisco.php +++ b/modules/discopower/lib/PowerIdPDisco.php @@ -133,8 +133,8 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco { $idp = $this->getTargetIdp(); if($idp !== NULL) { - if ($this->config->getValue('idpdisco.extDiscoveryStorage', NULL) != NULL) { - $extDiscoveryStorage = $this->config->getValue('idpdisco.extDiscoveryStorage'); + if ($this->config->getBoolean('idpdisco.extDiscoveryStorage', NULL) != NULL) { + $extDiscoveryStorage = $this->config->getBoolean('idpdisco.extDiscoveryStorage'); $this->log('Choice made [' . $idp . '] (Forwarding to external discovery storage)'); SimpleSAML_Utilities::redirect($extDiscoveryStorage, array( 'entityID' => $this->spEntityId, diff --git a/modules/saml2/lib/Message.php b/modules/saml2/lib/Message.php index 68b65ca9c63dde842504786c244c734f68cb48a4..369006286b0d6bd5dda43851c30b8226105157f7 100644 --- a/modules/saml2/lib/Message.php +++ b/modules/saml2/lib/Message.php @@ -22,7 +22,7 @@ class sspmod_saml2_Message { public static function getDebugDestination() { $globalConfig = SimpleSAML_Configuration::getInstance(); - if (!$globalConfig->getValue('debug')) { + if (!$globalConfig->getBoolean('debug', FALSE)) { return NULL; } @@ -165,7 +165,7 @@ class sspmod_saml2_Message { var_export($srcMetadata->getString('entityid'), TRUE)); } $globalConfig = SimpleSAML_Configuration::getInstance(); - $caFile = $globalConfig->getPathValue('certdir') . $caFile; + $caFile = $globalConfig->getPathValue('certdir', 'cert/') . $caFile; if (count($certificates) === 0) { /* We need the full certificate in order to check it against the CA file. */ @@ -528,7 +528,7 @@ class sspmod_saml2_Message { $a->setAuthnContext(SAML2_Const::AC_PASSWORD); - $sessionLifetime = $config->getInteger('session.duration', 3600); + $sessionLifetime = $config->getInteger('session.duration', 8*60*60); $a->setSessionNotOnOrAfter(time() + $sessionLifetime); $session = SimpleSAML_Session::getInstance(); diff --git a/modules/saml2/www/sp/metadata.php b/modules/saml2/www/sp/metadata.php index 77f542c93ed48413a00d3c5c463232f71ba617de..b3462d63018c8f63a12201aefdcc3886306f2ec0 100644 --- a/modules/saml2/www/sp/metadata.php +++ b/modules/saml2/www/sp/metadata.php @@ -28,8 +28,8 @@ $metaBuilder->addMetadataSP20($metaArray); $config = SimpleSAML_Configuration::getInstance(); $metaBuilder->addContact('technical', array( - 'emailAddress' => $config->getValue('technicalcontact_email'), - 'name' => $config->getValue('technicalcontact_name'), + 'emailAddress' => $config->getString('technicalcontact_email', NULL), + 'name' => $config->getString('technicalcontact_name', NULL), )); $xml = $metaBuilder->getEntityDescriptorText(); diff --git a/www/admin/metadata.php b/www/admin/metadata.php index ec8aa9cc05df4cbb3a39ee15bed68319baf1d831..91e1d22fd7776ec13ce35ba0bb5d423c6c572491 100644 --- a/www/admin/metadata.php +++ b/www/admin/metadata.php @@ -18,7 +18,7 @@ try { $et = new SimpleSAML_XHTML_Template($config, 'admin-metadatalist.php', 'admin'); - if ($config->getValue('enable.saml20-sp') === true) { + if ($config->getBoolean('enable.saml20-sp', TRUE) === true) { $results = array(); $metalist = $metadata->getList('saml20-sp-hosted'); @@ -48,7 +48,7 @@ try { } - if ($config->getValue('enable.saml20-idp') === true) { + if ($config->getBoolean('enable.saml20-idp', FALSE) === true) { $results = array(); $metalist = $metadata->getList('saml20-idp-hosted'); foreach ($metalist AS $entityid => $mentry) { @@ -74,7 +74,7 @@ try { - if ($config->getValue('enable.shib13-sp') === true) { + if ($config->getBoolean('enable.shib13-sp', FALSE) === true) { $results = array(); $metalist = $metadata->getList('shib13-sp-hosted'); @@ -98,7 +98,7 @@ try { } - if ($config->getValue('enable.shib13-idp') === true) { + if ($config->getBoolean('enable.shib13-idp', FALSE) === true) { $results = array(); $metalist = $metadata->getList('shib13-idp-hosted'); foreach ($metalist AS $entityid => $mentry) { @@ -121,7 +121,7 @@ try { } - if ($config->getValue('enable.wsfed-sp') === true) { + if ($config->getBoolean('enable.wsfed-sp', FALSE) === true) { $results = array(); $metalist = $metadata->getList('wsfed-sp-hosted'); foreach ($metalist AS $entityid => $mentry) { diff --git a/www/auth/login-admin.php b/www/auth/login-admin.php index 2e9fc1eaab548ac57cbb79b2651cc9c93448393a..b68c265d1af2223994d3473caf9f9734749a3020 100644 --- a/www/auth/login-admin.php +++ b/www/auth/login-admin.php @@ -28,7 +28,7 @@ if (!array_key_exists('RelayState', $_REQUEST)) { $relaystate = $_REQUEST['RelayState']; -$correctpassword = $config->getValue('auth.adminpassword', '123'); +$correctpassword = $config->getString('auth.adminpassword', '123'); if (empty($correctpassword) or $correctpassword === '123') { SimpleSAML_Utilities::fatalError( diff --git a/www/authmemcookie.php b/www/authmemcookie.php index db8ab9a000f8d714a8f1c81afab5f9c8661f8161..fde955233865ef6236f76c60ce4fb0830a597c38 100644 --- a/www/authmemcookie.php +++ b/www/authmemcookie.php @@ -18,7 +18,7 @@ try { $session = SimpleSAML_Session::getInstance(); /* Check if this module is enabled. */ - if(!$globalConfig->getValue('enable.authmemcookie', FALSE)) { + if(!$globalConfig->getBoolean('enable.authmemcookie', FALSE)) { SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); } diff --git a/www/errorreport.php b/www/errorreport.php index 28ab5d16821581b4b534a770020ffc8c6cd09a76..2661dcc3c99bb37d892f359ec557b4a180125d55 100644 --- a/www/errorreport.php +++ b/www/errorreport.php @@ -94,7 +94,7 @@ if(array_key_exists('email', $_POST)) { } /* Send the email. */ -$toaddress = $config->getValue('technicalcontact_email', 'na@example.org'); +$toaddress = $config->getString('technicalcontact_email', 'na@example.org'); if($email !== 'na@example.org') { $email = new SimpleSAML_XHTML_EMail($email, 'simpleSAMLphp error report', $from); diff --git a/www/index.php b/www/index.php index fd5a8010e794fee147cf4ed1ea10faba30ef7dc3..510d43e188ad031053ed9dbbb5f422188f0a3759 100644 --- a/www/index.php +++ b/www/index.php @@ -7,7 +7,7 @@ $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getInstance(); /* Check if valid local session exists.. */ -if ($config->getValue('admin.protectindexpage', false)) { +if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML_Utilities::requireAdmin(); } $loginurl = SimpleSAML_Utilities::getAdminLoginURL(); @@ -24,12 +24,12 @@ if (SimpleSAML_Utilities::getSelfProtocol() != 'https') { $links = array(); -if ($config->getValue('enable.saml20-sp') === true) +if ($config->getBoolean('enable.saml20-sp', TRUE) === true) $links[] = array( 'href' => 'example-simple/saml2-example.php', 'text' => 'link_saml2example'); -if ($config->getValue('enable.shib13-sp') === true) +if ($config->getBoolean('enable.shib13-sp', FALSE) === true) $links[] = array( 'href' => 'example-simple/shib13-example.php', 'text' => 'link_shib13example' @@ -122,7 +122,7 @@ $linksmeta[] = array( $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $metaentries = array('hosted' => array(), 'remote' => array() ); -if ($config->getValue('enable.saml20-sp') === true) { +if ($config->getBoolean('enable.saml20-sp', TRUE) === true) { try { $metaentries['hosted']['saml20-sp'] = $metadata->getMetaDataCurrent('saml20-sp-hosted'); $metaentries['hosted']['saml20-sp']['metadata-url'] = '/' . $config->getBaseURL() . 'saml2/sp/metadata.php?output=xhtml'; @@ -130,7 +130,7 @@ if ($config->getValue('enable.saml20-sp') === true) { $metaentries['remote']['saml20-idp-remote'] = $metadata->getList('saml20-idp-remote'); } catch(Exception $e) {} } -if ($config->getValue('enable.saml20-idp') === true) { +if ($config->getBoolean('enable.saml20-idp', FALSE) === true) { try { $metaentries['hosted']['saml20-idp'] = $metadata->getMetaDataCurrent('saml20-idp-hosted'); $metaentries['hosted']['saml20-idp']['metadata-url'] = '/' . $config->getBaseURL() . 'saml2/idp/metadata.php?output=xhtml'; @@ -138,7 +138,7 @@ if ($config->getValue('enable.saml20-idp') === true) { $metaentries['remote']['saml20-sp-remote'] = $metadata->getList('saml20-sp-remote'); } catch(Exception $e) {} } -if ($config->getValue('enable.shib13-sp') === true) { +if ($config->getBoolean('enable.shib13-sp', FALSE) === true) { try { $metaentries['hosted']['shib13-sp'] = $metadata->getMetaDataCurrent('shib13-sp-hosted'); $metaentries['hosted']['shib13-sp']['metadata-url'] = '/' . $config->getBaseURL() . 'shib13/sp/metadata.php?output=xhtml'; @@ -146,7 +146,7 @@ if ($config->getValue('enable.shib13-sp') === true) { $metaentries['remote']['shib13-idp-remote'] = $metadata->getList('shib13-idp-remote'); } catch(Exception $e) {} } -if ($config->getValue('enable.shib13-idp') === true) { +if ($config->getBoolean('enable.shib13-idp', FALSE) === true) { try { $metaentries['hosted']['shib13-idp'] = $metadata->getMetaDataCurrent('shib13-idp-hosted'); $metaentries['hosted']['shib13-idp']['metadata-url'] = '/' . $config->getBaseURL() . 'shib13/idp/metadata.php?output=xhtml'; @@ -166,22 +166,22 @@ $linksdoc[] = array( 'href' => 'http://rnd.feide.no/content/installing-simplesamlphp', 'text' => 'link_doc_install'); -if ($config->getValue('enable.saml20-sp', false ) || $config->getValue('enable.shib13-sp', false)) +if ($config->getBoolean('enable.saml20-sp', TRUE) || $config->getBoolean('enable.shib13-sp', false)) $linksdoc[] = array( 'href' => 'http://rnd.feide.no/content/using-simplesamlphp-service-provider', 'text' => 'link_doc_sp'); -if ($config->getValue('enable.saml20-idp', false ) || $config->getValue('enable.shib13-idp', false)) +if ($config->getBoolean('enable.saml20-idp', false ) || $config->getBoolean('enable.shib13-idp', false)) $linksdoc[] = array( 'href' => 'http://rnd.feide.no/content/using-simplesamlphp-identity-provider', 'text' => 'link_doc_idp'); -if ($config->getValue('enable.shib13-idp', false)) +if ($config->getBoolean('enable.shib13-idp', false)) $linksdoc[] = array( 'href' => 'http://rnd.feide.no/content/configure-shibboleth-13-sp-work-simplesamlphp-idp', 'text' => 'link_doc_shibsp'); -if ($config->getValue('enable.saml20-idp', false )) +if ($config->getBoolean('enable.saml20-idp', false )) $linksdoc[] = array( 'href' => 'http://rnd.feide.no/content/simplesamlphp-idp-google-apps-education', 'text' => 'link_doc_googleapps'); @@ -207,10 +207,10 @@ $allLinks = array( SimpleSAML_Module::callHooks('frontpage', $allLinks); $enablematrix = array( - 'saml20-sp' => $config->getValue('enable.saml20-sp', false), - 'saml20-idp' => $config->getValue('enable.saml20-idp', false), - 'shib13-sp' => $config->getValue('enable.shib13-sp', false), - 'shib13-idp' => $config->getValue('enable.shib13-idp', false), + 'saml20-sp' => $config->getBoolean('enable.saml20-sp', TRUE), + 'saml20-idp' => $config->getBoolean('enable.saml20-idp', false), + 'shib13-sp' => $config->getBoolean('enable.shib13-sp', false), + 'shib13-idp' => $config->getBoolean('enable.shib13-idp', false), ); @@ -242,7 +242,7 @@ foreach ($functionchecks AS $func => $descr) { /* Some basic configuration checks */ -if($config->getValue('technicalcontact_email', 'na@example.org') === 'na@example.org') { +if($config->getString('technicalcontact_email', 'na@example.org') === 'na@example.org') { $mail_ok = FALSE; } else { $mail_ok = TRUE; @@ -252,7 +252,7 @@ $funcmatrix[] = array( 'descr' => 'technicalcontact_email option set', 'enabled' => $mail_ok ); -if($config->getValue('auth.adminpassword', '123') === '123') { +if($config->getString('auth.adminpassword', '123') === '123') { $password_ok = FALSE; } else { $password_ok = TRUE; diff --git a/www/saml2/idp/SSOService.php b/www/saml2/idp/SSOService.php index 3560c3a2733eb8fa6ab7d5196931642389dd49a2..d9d78884cfe74d316737484bc9f997e4c308c77d 100644 --- a/www/saml2/idp/SSOService.php +++ b/www/saml2/idp/SSOService.php @@ -30,7 +30,7 @@ try { SimpleSAML_Logger::info('SAML2.0 - IdP.SSOService: Accessing SAML 2.0 IdP endpoint SSOService'); -if (!$config->getValue('enable.saml20-idp', false)) +if (!$config->getBoolean('enable.saml20-idp', false)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); diff --git a/www/saml2/idp/SingleLogoutService.php b/www/saml2/idp/SingleLogoutService.php index 764f8b0635f6ad7d3c9f9e696f964a53ce9c80fb..a0aa2a5ce08f14280351cb179b7f9ac6a46c63e3 100644 --- a/www/saml2/idp/SingleLogoutService.php +++ b/www/saml2/idp/SingleLogoutService.php @@ -19,7 +19,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: Accessing SAML 2.0 IdP endpoint SingleLogoutService'); -if (!$config->getValue('enable.saml20-idp', false)) +if (!$config->getBoolean('enable.saml20-idp', false)) SimpleSAML_Utilities::fatalError(isset($session) ? $session->getTrackID() : null, 'NOACCESS'); try { @@ -250,7 +250,7 @@ if ($spEntityId) { } } -if ($config->getValue('debug', false)) +if ($config->getBoolean('debug', false)) SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: LogoutService: All SPs done '); @@ -297,12 +297,12 @@ try { /** * Clean up session object to save storage. */ - if ($config->getValue('debug', false)) + if ($config->getBoolean('debug', false)) SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: Session Size before cleaning: ' . $session->getSize()); $session->clean(); - if ($config->getValue('debug', false)) + if ($config->getBoolean('debug', false)) SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: Session Size after cleaning: ' . $session->getSize()); diff --git a/www/saml2/idp/SingleLogoutServiceiFrame.php b/www/saml2/idp/SingleLogoutServiceiFrame.php index 144bf43295556225e016407c8777ea8dc508051b..4202c1a5663ac3ecc647ae91a1044234f3a96ec4 100644 --- a/www/saml2/idp/SingleLogoutServiceiFrame.php +++ b/www/saml2/idp/SingleLogoutServiceiFrame.php @@ -19,7 +19,7 @@ SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutServiceiFrame: Accessing SAML SimpleSAML_Logger::debug('Initially; ' . join(',', $session->get_sp_list(SimpleSAML_Session::STATE_ONLINE))); -if (!$config->getValue('enable.saml20-idp', false)) +if (!$config->getBoolean('enable.saml20-idp', false)) SimpleSAML_Utilities::fatalError(isset($session) ? $session->getTrackID() : null, 'NOACCESS'); try { @@ -145,12 +145,12 @@ function updateslostatus() { /** * Clean up session object to save storage. */ - if ($config->getValue('debug', false)) + if ($config->getBoolean('debug', false)) SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: Session Size before cleaning: ' . $session->getSize()); $session->clean(); - if ($config->getValue('debug', false)) + if ($config->getBoolean('debug', false)) SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: Session Size after cleaning: ' . $session->getSize()); } else { diff --git a/www/saml2/idp/SingleLogoutServiceiFrameNoJavascript.php b/www/saml2/idp/SingleLogoutServiceiFrameNoJavascript.php index 73a7b01478d19b03997e07e208b2d4b3fa2bd77d..c5a96ea3a84a5fba379861abdf87ad6c5f46276c 100644 --- a/www/saml2/idp/SingleLogoutServiceiFrameNoJavascript.php +++ b/www/saml2/idp/SingleLogoutServiceiFrameNoJavascript.php @@ -17,7 +17,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutServiceiFrame: Accessing SAML 2.0 IdP endpoint SingleLogoutService (iFrame version)'); -if (!$config->getValue('enable.saml20-idp', false)) +if (!$config->getBoolean('enable.saml20-idp', false)) SimpleSAML_Utilities::fatalError(isset($session) ? $session->getTrackID() : null, 'NOACCESS'); try { diff --git a/www/saml2/idp/SingleLogoutServiceiFrameResponse.php b/www/saml2/idp/SingleLogoutServiceiFrameResponse.php index 1012d3af738ed5e418031da763c448a6b6601209..ec72fb2e08e7b57c4252f5cdc791fbf63f7228d7 100644 --- a/www/saml2/idp/SingleLogoutServiceiFrameResponse.php +++ b/www/saml2/idp/SingleLogoutServiceiFrameResponse.php @@ -17,7 +17,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutServiceiFrameResponse: Accessing SAML 2.0 IdP endpoint SingleLogoutServiceResponse (iFrame version)'); -if (!$config->getValue('enable.saml20-idp', false)) +if (!$config->getBoolean('enable.saml20-idp', false)) SimpleSAML_Utilities::fatalError(isset($session) ? $session->getTrackID() : null, 'NOACCESS'); try { diff --git a/www/saml2/idp/idpInitSingleLogoutServiceiFrame.php b/www/saml2/idp/idpInitSingleLogoutServiceiFrame.php index b57d11d1dc0d95aee815429af4851fb4a3f28a1c..c75dcdcf0620470b068163e5509035f0b535ff84 100644 --- a/www/saml2/idp/idpInitSingleLogoutServiceiFrame.php +++ b/www/saml2/idp/idpInitSingleLogoutServiceiFrame.php @@ -18,7 +18,7 @@ SimpleSAML_Logger::info('SAML2.0 - IdP.idpInitSingleLogoutServiceiFrame: Accessi SimpleSAML_Logger::debug('Initially; ' . join(',', $session->get_sp_list(SimpleSAML_Session::STATE_ONLINE))); -if (!$config->getValue('enable.saml20-idp', false)) +if (!$config->getBoolean('enable.saml20-idp', false)) SimpleSAML_Utilities::fatalError(isset($session) ? $session->getTrackID() : null, 'NOACCESS'); try { @@ -138,12 +138,12 @@ function updateslostatus() { /** * Clean up session object to save storage. */ - if ($config->getValue('debug', false)) + if ($config->getBoolean('debug', false)) SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: Session Size before cleaning: ' . $session->getSize()); $session->clean(); - if ($config->getValue('debug', false)) + if ($config->getBoolean('debug', false)) SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutService: Session Size after cleaning: ' . $session->getSize()); } else { diff --git a/www/saml2/idp/initSLO.php b/www/saml2/idp/initSLO.php index 118fcb3088dffa0085732f139c9ecd504244ea3c..a1e12f4bd13efaa79f805d4638dfc466001f448b 100644 --- a/www/saml2/idp/initSLO.php +++ b/www/saml2/idp/initSLO.php @@ -8,7 +8,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('SAML2.0 - IdP.initSLO: Accessing SAML 2.0 IdP endpoint init Single Logout'); -if (!$config->getValue('enable.saml20-idp', false)) { +if (!$config->getBoolean('enable.saml20-idp', false)) { SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); } diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php index d24c73c807fa7a18e7f470e8803a77d22e637967..3dbf323b0a90b516302435f0c8c2045086528e24 100644 --- a/www/saml2/idp/metadata.php +++ b/www/saml2/idp/metadata.php @@ -7,11 +7,11 @@ $config = SimpleSAML_Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $session = SimpleSAML_Session::getInstance(); -if (!$config->getValue('enable.saml20-idp', false)) +if (!$config->getBoolean('enable.saml20-idp', false)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); /* Check if valid local session exists.. */ -if ($config->getValue('admin.protectmetadata', false)) { +if ($config->getBoolean('admin.protectmetadata', false)) { SimpleSAML_Utilities::requireAdmin(); } @@ -70,8 +70,8 @@ try { $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($idpentityid); $metaBuilder->addMetadataIdP20($metaArray); $metaBuilder->addContact('technical', array( - 'emailAddress' => $config->getValue('technicalcontact_email'), - 'name' => $config->getValue('technicalcontact_name'), + 'emailAddress' => $config->getString('technicalcontact_email', NULL), + 'name' => $config->getString('technicalcontact_name', NULL), )); $metaxml = $metaBuilder->getEntityDescriptorText(); @@ -79,7 +79,7 @@ try { $metaxml = SimpleSAML_Metadata_Signer::sign($metaxml, $idpmeta, 'SAML 2 IdP'); if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') { - $defaultidp = $config->getValue('default-saml20-idp'); + $defaultidp = $config->getString('default-saml20-idp', NULL); $t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin'); diff --git a/www/saml2/sp/AssertionConsumerService.php b/www/saml2/sp/AssertionConsumerService.php index f23b23139e46aef5b20819e4b7f8bc8340716fb6..f03dfbe3eb13dd410e14fbab564d8385677b6f4d 100644 --- a/www/saml2/sp/AssertionConsumerService.php +++ b/www/saml2/sp/AssertionConsumerService.php @@ -51,7 +51,7 @@ function finishLogin($authProcState) { SimpleSAML_Logger::info('SAML2.0 - SP.AssertionConsumerService: Accessing SAML 2.0 SP endpoint AssertionConsumerService'); -if (!$config->getValue('enable.saml20-sp', false)) +if (!$config->getBoolean('enable.saml20-sp', TRUE)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); if (array_key_exists(SimpleSAML_Auth_ProcessingChain::AUTHPARAM, $_REQUEST)) { diff --git a/www/saml2/sp/SingleLogoutService.php b/www/saml2/sp/SingleLogoutService.php index fa382950e4881ca378b56e9a9c97a0803816edf9..bd870327ba29f710a0ad8ee1566016926a9f463b 100644 --- a/www/saml2/sp/SingleLogoutService.php +++ b/www/saml2/sp/SingleLogoutService.php @@ -11,7 +11,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('SAML2.0 - SP.SingleLogoutService: Accessing SAML 2.0 SP endpoint SingleLogoutService'); -if (!$config->getValue('enable.saml20-sp', false)) +if (!$config->getBoolean('enable.saml20-sp', TRUE)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); diff --git a/www/saml2/sp/initSLO.php b/www/saml2/sp/initSLO.php index b7256406e62b8f85d34a789dd66f424d50f43999..410fa2411653aebbe3026d7530a12c3032732fcd 100644 --- a/www/saml2/sp/initSLO.php +++ b/www/saml2/sp/initSLO.php @@ -8,7 +8,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('SAML2.0 - SP.initSLO: Accessing SAML 2.0 SP initSLO script'); -if (!$config->getValue('enable.saml20-sp', false)) +if (!$config->getBoolean('enable.saml20-sp', TRUE)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); diff --git a/www/saml2/sp/initSSO.php b/www/saml2/sp/initSSO.php index 2ad1bb53b9c1c1232f2da2547271c0faa2196abf..fecc8f4f4244fb94c8cff8017ea4ca687359e522 100644 --- a/www/saml2/sp/initSSO.php +++ b/www/saml2/sp/initSSO.php @@ -9,7 +9,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('SAML2.0 - SP.initSSO: Accessing SAML 2.0 SP initSSO script'); -if (!$config->getValue('enable.saml20-sp', false)) +if (!$config->getBoolean('enable.saml20-sp', TRUE)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); /* @@ -26,7 +26,7 @@ if (empty($_GET['RelayState'])) { try { - $idpentityid = isset($_GET['idpentityid']) ? $_GET['idpentityid'] : $config->getValue('default-saml20-idp') ; + $idpentityid = isset($_GET['idpentityid']) ? $_GET['idpentityid'] : $config->getString('default-saml20-idp', NULL) ; $spentityid = isset($_GET['spentityid']) ? $_GET['spentityid'] : $metadata->getMetaDataCurrentEntityID(); if($idpentityid === NULL) { @@ -51,15 +51,15 @@ if ($idpentityid === NULL) { */ if(array_key_exists('idpdisco.url', $spmetadata)) { $discourl = $spmetadata['idpdisco.url']; - } elseif($config->getValue('idpdisco.url.saml20', NULL) !== NULL) { - $discourl = $config->getValue('idpdisco.url.saml20', NULL); + } elseif($config->getString('idpdisco.url.saml20', NULL) !== NULL) { + $discourl = $config->getString('idpdisco.url.saml20'); } else { $discourl = SimpleSAML_Utilities::selfURLhost() . '/' . $config->getBaseURL() . 'saml2/sp/idpdisco.php'; } - if ($config->getValue('idpdisco.extDiscoveryStorage', NULL) != NULL) { + if ($config->getBoolean('idpdisco.extDiscoveryStorage', NULL) != NULL) { - $extDiscoveryStorage = $config->getValue('idpdisco.extDiscoveryStorage'); + $extDiscoveryStorage = $config->getBoolean('idpdisco.extDiscoveryStorage'); SimpleSAML_Utilities::redirect($extDiscoveryStorage, array( 'entityID' => $spentityid, diff --git a/www/saml2/sp/metadata.php b/www/saml2/sp/metadata.php index 8c73dd208a8268e2c105ab1d573174e8f9b68e91..90d017392cce0e623e0ce234ed4f3490e2c164ab 100644 --- a/www/saml2/sp/metadata.php +++ b/www/saml2/sp/metadata.php @@ -8,11 +8,11 @@ $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $session = SimpleSAML_Session::getInstance(); -if (!$config->getValue('enable.saml20-sp', false)) +if (!$config->getValue('enable.saml20-sp', TRUE)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); /* Check if valid local session exists.. */ -if ($config->getValue('admin.protectmetadata', false)) { +if ($config->getBoolean('admin.protectmetadata', false)) { SimpleSAML_Utilities::requireAdmin(); } @@ -52,8 +52,8 @@ try { $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($spentityid); $metaBuilder->addMetadataSP20($metaArray); $metaBuilder->addContact('technical', array( - 'emailAddress' => $config->getValue('technicalcontact_email'), - 'name' => $config->getValue('technicalcontact_name'), + 'emailAddress' => $config->getString('technicalcontact_email', NULL), + 'name' => $config->getString('technicalcontact_name', NULL), )); $metaxml = $metaBuilder->getEntityDescriptorText(); @@ -142,7 +142,7 @@ try { if (array_key_exists('output', $_REQUEST) && $_REQUEST['output'] == 'xhtml') { - $defaultidp = $config->getValue('default-saml20-idp'); + $defaultidp = $config->getString('default-saml20-idp', NULL); $t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin'); @@ -156,9 +156,9 @@ try { $t->data['adminok'] = $adminok; $t->data['adminlogin'] = $adminlogin; - $t->data['techemail'] = $config->getValue('technicalcontact_email', NULL); + $t->data['techemail'] = $config->getString('technicalcontact_email', NULL); -// $t->data['version'] = $config->getValue('version', 'na'); +// $t->data['version'] = $config->getString('version', 'na'); // $t->data['defaultidp'] = $defaultidp; $t->show(); diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php index bfb6c3d415238dc8878fd006401097bab6ccb3ca..ce2b6bba4654040700a652dbb12e90f6ee63cacc 100644 --- a/www/shib13/idp/SSOService.php +++ b/www/shib13/idp/SSOService.php @@ -18,7 +18,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('Shib1.3 - IdP.SSOService: Accessing Shibboleth 1.3 IdP endpoint SSOService'); -if (!$config->getValue('enable.shib13-idp', false)) +if (!$config->getBoolean('enable.shib13-idp', false)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); try { diff --git a/www/shib13/idp/metadata.php b/www/shib13/idp/metadata.php index 071ac241361f019fd78b5af8f3af8557d3cdc13c..0ac1e257519851179fb6a3ee76622c81ef7d3c6a 100644 --- a/www/shib13/idp/metadata.php +++ b/www/shib13/idp/metadata.php @@ -7,11 +7,11 @@ $config = SimpleSAML_Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $session = SimpleSAML_Session::getInstance(); -if (!$config->getValue('enable.shib13-idp', false)) +if (!$config->getBoolean('enable.shib13-idp', false)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); /* Check if valid local session exists.. */ -if ($config->getValue('admin.protectmetadata', false)) { +if ($config->getBoolean('admin.protectmetadata', false)) { SimpleSAML_Utilities::requireAdmin(); } @@ -55,8 +55,8 @@ try { $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($idpentityid); $metaBuilder->addMetadataIdP11($metaArray); $metaBuilder->addContact('technical', array( - 'emailAddress' => $config->getValue('technicalcontact_email'), - 'name' => $config->getValue('technicalcontact_name'), + 'emailAddress' => $config->getString('technicalcontact_email', NULL), + 'name' => $config->getString('technicalcontact_name', NULL), )); $metaxml = $metaBuilder->getEntityDescriptorText(); @@ -65,7 +65,7 @@ try { if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') { - $defaultidp = $config->getValue('default-shib13-idp'); + $defaultidp = $config->getString('default-shib13-idp', NULL); $t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin'); diff --git a/www/shib13/sp/AssertionConsumerService.php b/www/shib13/sp/AssertionConsumerService.php index c4948e45941bb6794bd602cf647bbe5a980cb72c..3b4df64efeaead50e9ba013f7dd9d683373464bb 100644 --- a/www/shib13/sp/AssertionConsumerService.php +++ b/www/shib13/sp/AssertionConsumerService.php @@ -39,7 +39,7 @@ function finishLogin($authProcState) { SimpleSAML_Logger::info('Shib1.3 - SP.AssertionConsumerService: Accessing Shibboleth 1.3 SP endpoint AssertionConsumerService'); -if (!$config->getValue('enable.shib13-sp', false)) +if (!$config->getBoolean('enable.shib13-sp', false)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); if (array_key_exists(SimpleSAML_Auth_ProcessingChain::AUTHPARAM, $_REQUEST)) { diff --git a/www/shib13/sp/initSSO.php b/www/shib13/sp/initSSO.php index 00bc56846a19bf905874170f7b16c312f5187388..3a3b185ecde8c375f89487af12b384b5b967547a 100644 --- a/www/shib13/sp/initSSO.php +++ b/www/shib13/sp/initSSO.php @@ -20,13 +20,13 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('Shib1.3 - SP.initSSO: Accessing Shib 1.3 SP initSSO script'); -if (!$config->getValue('enable.shib13-sp', false)) +if (!$config->getBoolean('enable.shib13-sp', false)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); try { - $idpentityid = isset($_GET['idpentityid']) ? $_GET['idpentityid'] : $config->getValue('default-shib13-idp') ; + $idpentityid = isset($_GET['idpentityid']) ? $_GET['idpentityid'] : $config->getString('default-shib13-idp', NULL) ; $spentityid = isset($_GET['spentityid']) ? $_GET['spentityid'] : $metadata->getMetaDataCurrentEntityID('shib13-sp-hosted'); if($idpentityid === NULL) { @@ -52,8 +52,8 @@ if (!isset($session) || !$session->isValid('shib13') ) { */ if(array_key_exists('idpdisco.url', $spmetadata)) { $discservice = $spmetadata['idpdisco.url']; - } elseif($config->getValue('idpdisco.url.shib13', NULL) !== NULL) { - $discservice = $config->getValue('idpdisco.url.shib13', NULL); + } elseif($config->getString('idpdisco.url.shib13', NULL) !== NULL) { + $discservice = $config->getString('idpdisco.url.shib13'); } else { $discservice = '/' . $config->getBaseURL() . 'shib13/sp/idpdisco.php'; } diff --git a/www/shib13/sp/metadata.php b/www/shib13/sp/metadata.php index 39c92d540669d16860c9585d5182cff175555e53..489de92da11fbf4c6097e09dbb6f34d1c5c560bc 100644 --- a/www/shib13/sp/metadata.php +++ b/www/shib13/sp/metadata.php @@ -8,11 +8,11 @@ $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $session = SimpleSAML_Session::getInstance(); -if (!$config->getValue('enable.shib13-sp', false)) +if (!$config->getBoolean('enable.shib13-sp', false)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); /* Check if valid local session exists.. */ -if ($config->getValue('admin.protectmetadata', false)) { +if ($config->getBoolean('admin.protectmetadata', false)) { SimpleSAML_Utilities::requireAdmin(); } @@ -56,8 +56,8 @@ try { $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($spentityid); $metaBuilder->addMetadataSP11($metaArray); $metaBuilder->addContact('technical', array( - 'emailAddress' => $config->getValue('technicalcontact_email'), - 'name' => $config->getValue('technicalcontact_name'), + 'emailAddress' => $config->getString('technicalcontact_email', NULL), + 'name' => $config->getString('technicalcontact_name', NULL), )); $metaxml = $metaBuilder->getEntityDescriptorText(); @@ -65,7 +65,7 @@ try { $metaxml = SimpleSAML_Metadata_Signer::sign($metaxml, $spmeta, 'Shib 1.3 SP'); if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') { - $defaultidp = $config->getValue('default-shib13-idp'); + $defaultidp = $config->getString('default-shib13-idp', NULL); $t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin'); @@ -82,8 +82,8 @@ try { } */ - $t->data['techemail'] = $config->getValue('technicalcontact_email', 'na'); - $t->data['version'] = $config->getValue('version', 'na'); + $t->data['techemail'] = $config->getString('technicalcontact_email', 'na'); + $t->data['version'] = $config->getString('version', 'na'); $t->data['defaultidp'] = $defaultidp; $t->show(); diff --git a/www/wsfed/sp/initSLO.php b/www/wsfed/sp/initSLO.php index 02b9e2f10cba2b0ccd5a16dc05ecd62cee1915b8..0132f9284b97a8aac41a3974b4ffb846b1114dea 100644 --- a/www/wsfed/sp/initSLO.php +++ b/www/wsfed/sp/initSLO.php @@ -8,7 +8,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('WS-Fed - SP.initSLO: Accessing WS-Fed SP initSLO script'); -if (!$config->getValue('enable.wsfed-sp', false)) +if (!$config->getBoolean('enable.wsfed-sp', false)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); diff --git a/www/wsfed/sp/initSSO.php b/www/wsfed/sp/initSSO.php index 0e27ff448fc98e6c0e81d07295eedff33fb48476..9be61bf976bd67faa2b0f232b227188d061d75b3 100644 --- a/www/wsfed/sp/initSSO.php +++ b/www/wsfed/sp/initSSO.php @@ -19,7 +19,7 @@ $session = SimpleSAML_Session::getInstance(); SimpleSAML_Logger::info('WS-Fed - SP.initSSO: Accessing WS-Fed SP initSSO script'); -if (!$config->getValue('enable.wsfed-sp', false)) +if (!$config->getBoolean('enable.wsfed-sp', false)) SimpleSAML_Utilities::fatalError($session->getTrackID(), 'NOACCESS'); if (empty($_GET['RelayState'])) { diff --git a/www/wsfed/sp/prp.php b/www/wsfed/sp/prp.php index 396656f434beaf01508afe86eee855a552619b46..d5c3becc79a338afc36e034585d7dc2f69fd1463 100644 --- a/www/wsfed/sp/prp.php +++ b/www/wsfed/sp/prp.php @@ -78,7 +78,7 @@ try { /* Find the certificate used by the IdP. */ if(array_key_exists('certificate', $idpMetadata)) { - $certFile = $config->getPathvalue('certdir') . $idpMetadata['certificate']; + $certFile = $config->getPathvalue('certdir', 'cert/') . $idpMetadata['certificate']; } else { throw new Exception('Missing \'certificate\' metadata option in the \'wsfed-idp-remote\' metadata' . ' for the IdP \'' . $idpEntityId . '\'.');