From 8046bb239b19b241afd9520141fa12a9a4f68e39 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Tue, 29 May 2018 21:27:38 +0200 Subject: [PATCH] Replace SimpleSAML_Configuration with namespaced version --- bin/memcacheSync.php | 2 +- docs/simplesamlphp-database.md | 6 +- docs/simplesamlphp-errorhandling.md | 2 +- docs/simplesamlphp-sp-migration.md | 4 +- lib/SimpleSAML/Auth/ProcessingChain.php | 4 +- lib/SimpleSAML/Auth/Simple.php | 4 +- lib/SimpleSAML/Auth/Source.php | 8 +- lib/SimpleSAML/Auth/State.php | 2 +- lib/SimpleSAML/AuthMemCookie.php | 4 +- lib/SimpleSAML/Bindings/Shib13/Artifact.php | 6 +- lib/SimpleSAML/Bindings/Shib13/HTTPPost.php | 15 +- lib/SimpleSAML/Configuration.php | 182 ++++++------ lib/SimpleSAML/Database.php | 10 +- .../Error/CriticalConfigurationError.php | 3 +- lib/SimpleSAML/Error/Error.php | 4 +- lib/SimpleSAML/Error/Exception.php | 4 +- lib/SimpleSAML/IdP.php | 6 +- lib/SimpleSAML/Locale/Language.php | 10 +- lib/SimpleSAML/Locale/Localization.php | 6 +- lib/SimpleSAML/Locale/Translate.php | 13 +- lib/SimpleSAML/Logger.php | 4 +- .../Logger/ErrorLogLoggingHandler.php | 5 +- lib/SimpleSAML/Logger/FileLoggingHandler.php | 2 +- .../Logger/LoggingHandlerInterface.php | 6 +- .../Logger/StandardErrorLoggingHandler.php | 2 +- .../Logger/SyslogLoggingHandler.php | 2 +- lib/SimpleSAML/Memcache.php | 6 +- .../Metadata/MetaDataStorageHandler.php | 14 +- .../MetaDataStorageHandlerFlatFile.php | 2 +- .../MetaDataStorageHandlerSerialize.php | 4 +- .../Metadata/MetaDataStorageHandlerXML.php | 2 +- lib/SimpleSAML/Metadata/SAMLBuilder.php | 24 +- lib/SimpleSAML/Metadata/Signer.php | 16 +- lib/SimpleSAML/Metadata/Sources/MDQ.php | 2 +- lib/SimpleSAML/Module.php | 5 +- lib/SimpleSAML/Session.php | 16 +- lib/SimpleSAML/SessionHandler.php | 2 +- lib/SimpleSAML/SessionHandlerCookie.php | 2 +- lib/SimpleSAML/SessionHandlerPHP.php | 4 +- lib/SimpleSAML/SessionHandlerStore.php | 2 +- lib/SimpleSAML/Stats.php | 6 +- lib/SimpleSAML/Stats/Output.php | 4 +- lib/SimpleSAML/Store.php | 2 +- lib/SimpleSAML/Store/Memcache.php | 2 +- lib/SimpleSAML/Store/Redis.php | 2 +- lib/SimpleSAML/Store/SQL.php | 2 +- lib/SimpleSAML/Utilities.php | 4 +- lib/SimpleSAML/Utils/Config.php | 4 +- lib/SimpleSAML/Utils/Crypto.php | 12 +- lib/SimpleSAML/Utils/HTTP.php | 19 +- lib/SimpleSAML/Utils/System.php | 4 +- lib/SimpleSAML/Utils/Time.php | 2 +- lib/SimpleSAML/Utils/XML.php | 8 +- lib/SimpleSAML/XHTML/IdPDisco.php | 4 +- lib/SimpleSAML/XHTML/Template.php | 6 +- lib/SimpleSAML/XML/Shib13/AuthnResponse.php | 6 +- modules/adfs/lib/IdP/ADFS.php | 2 +- modules/adfs/www/idp/metadata.php | 2 +- .../authX509/lib/Auth/Source/X509userCert.php | 2 +- modules/authX509/www/expirywarning.php | 2 +- modules/authYubiKey/www/yubikeylogin.php | 2 +- .../authfacebook/lib/Auth/Source/Facebook.php | 2 +- modules/authorize/www/authorize_403.php | 2 +- .../authtwitter/lib/Auth/Source/Twitter.php | 2 +- modules/cas/lib/Auth/Source/CAS.php | 2 +- modules/casserver/www/login.php | 6 +- modules/casserver/www/proxy.php | 4 +- modules/casserver/www/serviceValidate.php | 2 +- modules/casserver/www/validate.php | 1 + modules/cdc/lib/Server.php | 2 +- modules/consent/lib/Consent/Store/Cookie.php | 2 +- modules/consent/www/getconsent.php | 2 +- modules/consent/www/logout_completed.php | 2 +- modules/consent/www/noconsent.php | 2 +- modules/consentAdmin/www/consentAdmin.php | 4 +- modules/core/hooks/hook_sanitycheck.php | 2 +- modules/core/lib/ACL.php | 2 +- .../core/lib/Auth/Process/AttributeMap.php | 2 +- .../lib/Auth/Process/ExtendIdPSession.php | 2 +- .../core/lib/Auth/Process/ScopeAttribute.php | 2 +- .../lib/Auth/Process/ScopeFromAttribute.php | 2 +- .../core/lib/Auth/Source/AdminPassword.php | 2 +- modules/core/lib/Auth/UserPassBase.php | 2 +- modules/core/lib/Stats/Output/File.php | 4 +- modules/core/lib/Stats/Output/Log.php | 5 +- .../core/lib/Storage/SQLPermanentStorage.php | 2 +- modules/core/www/authenticate.php | 2 +- modules/core/www/cardinality_error.php | 2 +- modules/core/www/cleardiscochoices.php | 2 +- modules/core/www/frontpage_auth.php | 12 +- modules/core/www/frontpage_config.php | 4 +- modules/core/www/frontpage_federation.php | 23 +- modules/core/www/frontpage_welcome.php | 18 +- modules/core/www/idp/logout-iframe.php | 2 +- modules/core/www/loginuserpass.php | 2 +- modules/core/www/loginuserpassorg.php | 2 +- modules/core/www/no_cookie.php | 2 +- modules/core/www/postredirect.php | 2 +- modules/core/www/short_sso_interval.php | 2 +- modules/core/www/show_metadata.php | 2 +- modules/cron/hooks/hook_cron.php | 2 +- modules/cron/lib/Cron.php | 8 +- modules/cron/www/cron.php | 4 +- modules/cron/www/croninfo.php | 4 +- modules/discopower/lib/PowerIdPDisco.php | 4 +- modules/expirycheck/www/about2expire.php | 2 +- modules/expirycheck/www/expired.php | 2 +- modules/ldap/lib/Auth/Process/BaseFilter.php | 8 +- modules/ldap/lib/Auth/Source/LDAPMulti.php | 2 +- modules/ldap/lib/ConfigHelper.php | 2 +- modules/memcacheMonitor/www/memcachestat.php | 2 +- modules/metarefresh/bin/metarefresh.php | 2 +- modules/metarefresh/hooks/hook_cron.php | 6 +- modules/metarefresh/lib/ARP.php | 2 +- modules/metarefresh/lib/MetaLoader.php | 4 +- modules/metarefresh/www/fetch.php | 6 +- .../multiauth/lib/Auth/Source/MultiAuth.php | 6 +- modules/multiauth/www/selectsource.php | 2 +- .../negotiate/lib/Auth/Source/Negotiate.php | 3 +- modules/negotiate/www/disable.php | 2 +- modules/negotiate/www/enable.php | 2 +- modules/oauth/hooks/hook_cron.php | 2 +- modules/oauth/lib/OAuthStore.php | 2 +- modules/oauth/www/getUserInfo.php | 2 +- modules/oauth/www/registry.edit.php | 6 +- modules/oauth/www/registry.php | 6 +- modules/portal/hooks/hook_htmlinject.php | 2 +- modules/portal/lib/Portal.php | 2 +- modules/preprodwarning/www/showwarning.php | 2 +- modules/radius/lib/Auth/Source/Radius.php | 2 +- modules/riak/lib/Store/Store.php | 2 +- modules/saml/lib/Auth/Source/SP.php | 18 +- modules/saml/lib/IdP/SAML1.php | 4 +- modules/saml/lib/IdP/SAML2.php | 85 +++--- modules/saml/lib/Message.php | 107 +++---- modules/saml/www/idp/certs.php | 4 +- modules/saml/www/proxy/invalid_session.php | 4 +- modules/saml/www/sp/metadata.php | 4 +- .../www/sp/wrong_authncontextclassref.php | 2 +- modules/sanitycheck/hooks/hook_cron.php | 4 +- modules/sanitycheck/www/index.php | 2 +- modules/statistics/bin/loganalyzer.php | 6 +- modules/statistics/bin/logcleaner.php | 4 +- modules/statistics/hooks/hook_cron.php | 2 +- modules/statistics/hooks/hook_sanitycheck.php | 2 +- modules/statistics/lib/AccessCheck.php | 2 +- modules/statistics/lib/Aggregator.php | 2 +- modules/statistics/lib/LogCleaner.php | 2 +- modules/statistics/lib/StatDataset.php | 6 +- .../lib/Statistics/Rulesets/BaseRule.php | 4 +- .../lib/Statistics/Rulesets/Ratio.php | 4 +- modules/statistics/www/showstats.php | 4 +- modules/statistics/www/statmeta.php | 4 +- tests/Utils/ReduceSpillOverTest.php | 6 +- tests/Utils/StateClearer.php | 3 +- tests/lib/SimpleSAML/Auth/SimpleTest.php | 7 +- .../SimpleSAML/Auth/TimeLimitedTokenTest.php | 11 +- tests/lib/SimpleSAML/ConfigurationTest.php | 280 +++++++++--------- tests/lib/SimpleSAML/DatabaseTest.php | 26 +- tests/lib/SimpleSAML/Locale/LanguageTest.php | 33 +-- .../SimpleSAML/Locale/LocalizationTest.php | 7 +- tests/lib/SimpleSAML/Locale/TranslateTest.php | 4 +- tests/lib/SimpleSAML/ModuleTest.php | 5 +- tests/lib/SimpleSAML/Store/RedisTest.php | 4 +- tests/lib/SimpleSAML/Store/SQLTest.php | 6 +- tests/lib/SimpleSAML/StoreTest.php | 4 +- tests/lib/SimpleSAML/Utils/CryptoTest.php | 2 +- tests/lib/SimpleSAML/Utils/HTTPTest.php | 27 +- tests/lib/SimpleSAML/Utils/SystemTest.php | 14 +- tests/lib/SimpleSAML/Utils/TimeTest.php | 9 +- tests/lib/SimpleSAML/Utils/XMLTest.php | 4 +- tests/lib/SimpleSAML/XML/SignerTest.php | 4 +- tests/lib/SimpleSAML/XML/ValidatorTest.php | 4 +- .../consent/lib/Auth/Process/ConsentTest.php | 2 +- .../lib/Auth/Process/AttributeLimitTest.php | 3 +- .../Auth/Process/CardinalitySingleTest.php | 2 +- .../core/lib/Auth/Process/CardinalityTest.php | 2 +- .../lib/Storage/SQLPermanentStorageTest.php | 2 +- .../lib/Auth/Source/Auth_Source_SP_Test.php | 6 +- tests/routers/configLoader.php | 2 +- www/_include.php | 2 +- www/admin/hostnames.php | 4 +- www/admin/index.php | 4 +- www/admin/metadata-converter.php | 2 +- www/admin/sandbox.php | 4 +- www/authmemcookie.php | 2 +- www/errorreport.php | 2 +- www/logout.php | 2 +- www/saml2/idp/ArtifactResolutionService.php | 2 +- www/saml2/idp/metadata.php | 2 +- www/shib13/idp/metadata.php | 2 +- 191 files changed, 746 insertions(+), 793 deletions(-) diff --git a/bin/memcacheSync.php b/bin/memcacheSync.php index 64605a952..dc4a4b14c 100755 --- a/bin/memcacheSync.php +++ b/bin/memcacheSync.php @@ -26,7 +26,7 @@ require_once($baseDir.'/lib/_autoload.php'); // Initialize the configuration $configdir = SimpleSAML\Utils\Config::getConfigDir(); -SimpleSAML_Configuration::setConfigDir($configdir); +\SimpleSAML\Configuration::setConfigDir($configdir); // Things we should warn the user about $warnServerDown = 0; diff --git a/docs/simplesamlphp-database.md b/docs/simplesamlphp-database.md index 663fdce15..01fbd5d94 100644 --- a/docs/simplesamlphp-database.md +++ b/docs/simplesamlphp-database.md @@ -20,12 +20,12 @@ Getting Started --------------- If you are just using the already configured database, which would normally be the case, all you need to do is get the global instance of the Database class. - $db = SimpleSAML\Database::getInstance(); + $db = \SimpleSAML\Database::getInstance(); If there is a requirement to connect to an alternate database server (ex. authenticating users that exist on a different SQL server or database) you can specify an alternate configuration. - $config = new SimpleSAML_Configuration($myconfigarray, "mymodule/lib/Auth/Source/myauth.php"); - $db = SimpleSAML\Database::getInstance($config); + $config = new \SimpleSAML\Configuration($myconfigarray, "mymodule/lib/Auth/Source/myauth.php"); + $db = \SimpleSAML\Database::getInstance($config); That will create a new instance of the database, separate from the global instance, specific to the configuration defined in $myconfigarray. If you are going to specify an alternate config, your configuration array must contain the same keys that exist in the master config (database.dsn, database.username, database.password, database.prefix, etc). diff --git a/docs/simplesamlphp-errorhandling.md b/docs/simplesamlphp-errorhandling.md index 278cad2c2..02195b056 100644 --- a/docs/simplesamlphp-errorhandling.md +++ b/docs/simplesamlphp-errorhandling.md @@ -233,7 +233,7 @@ Optional custom error show function, called from SimpleSAML_Error_Error::show, i Example code for this function, which implements the same functionality as SimpleSAML_Error_Error::show, looks something like: - public static function show(SimpleSAML_Configuration $config, array $data) { + public static function show(\SimpleSAML\Configuration $config, array $data) { $t = new SimpleSAML_XHTML_Template($config, 'error.php', 'errors'); $t->data = array_merge($t->data, $data); $t->show(); diff --git a/docs/simplesamlphp-sp-migration.md b/docs/simplesamlphp-sp-migration.md index ae3303cf8..1b9e6d3f6 100644 --- a/docs/simplesamlphp-sp-migration.md +++ b/docs/simplesamlphp-sp-migration.md @@ -154,8 +154,8 @@ This is a quick overview of the API: Generally, if you have: - $config = SimpleSAML_Configuration::getInstance(); - $session = SimpleSAML_Session::getSessionFromRequest(); + $config = \SimpleSAML\Configuration::getInstance(); + $session = \SimpleSAML_Session::getSessionFromRequest(); you should replace it with this single line: diff --git a/lib/SimpleSAML/Auth/ProcessingChain.php b/lib/SimpleSAML/Auth/ProcessingChain.php index 1477203f7..bd6ce6267 100644 --- a/lib/SimpleSAML/Auth/ProcessingChain.php +++ b/lib/SimpleSAML/Auth/ProcessingChain.php @@ -12,8 +12,6 @@ */ class SimpleSAML_Auth_ProcessingChain { - - /** * The list of remaining filters which should be applied to the state. */ @@ -53,7 +51,7 @@ class SimpleSAML_Auth_ProcessingChain $this->filters = array(); - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $configauthproc = $config->getArray('authproc.' . $mode, null); if (!empty($configauthproc)) { diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php index 9ad8e86a2..bdc0871ac 100644 --- a/lib/SimpleSAML/Auth/Simple.php +++ b/lib/SimpleSAML/Auth/Simple.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Auth; use \SimpleSAML_Auth_Source as Source; use \SimpleSAML_Auth_State as State; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML_Error_AuthSource as AuthSourceError; use \SimpleSAML\Module; use \SimpleSAML_Session as Session; @@ -26,7 +26,7 @@ class Simple protected $authSource; /** - * @var \SimpleSAML_Configuration|null + * @var \SimpleSAML\Configuration|null */ protected $app_config; diff --git a/lib/SimpleSAML/Auth/Source.php b/lib/SimpleSAML/Auth/Source.php index 44cd69a72..1efb0fae5 100644 --- a/lib/SimpleSAML/Auth/Source.php +++ b/lib/SimpleSAML/Auth/Source.php @@ -12,8 +12,6 @@ use SimpleSAML\Auth\SourceFactory; */ abstract class SimpleSAML_Auth_Source { - - /** * The authentication source identifier. This identifier can be used to look up this object, for example when * returning from a login form. @@ -54,7 +52,7 @@ abstract class SimpleSAML_Auth_Source { assert(is_string($type)); - $config = SimpleSAML_Configuration::getConfig('authsources.php'); + $config = \SimpleSAML\Configuration::getConfig('authsources.php'); $ret = array(); @@ -343,7 +341,7 @@ abstract class SimpleSAML_Auth_Source assert($type === null || is_string($type)); // for now - load and parse config file - $config = SimpleSAML_Configuration::getConfig('authsources.php'); + $config = \SimpleSAML\Configuration::getConfig('authsources.php'); $authConfig = $config->getArray($authId, null); if ($authConfig === null) { @@ -487,7 +485,7 @@ abstract class SimpleSAML_Auth_Source */ public static function getSources() { - $config = SimpleSAML_Configuration::getOptionalConfig('authsources.php'); + $config = \SimpleSAML\Configuration::getOptionalConfig('authsources.php'); return $config->getOptions(); } diff --git a/lib/SimpleSAML/Auth/State.php b/lib/SimpleSAML/Auth/State.php index 06bee7ae8..0e6d451e5 100644 --- a/lib/SimpleSAML/Auth/State.php +++ b/lib/SimpleSAML/Auth/State.php @@ -171,7 +171,7 @@ class SimpleSAML_Auth_State private static function getStateTimeout() { if (self::$stateTimeout === null) { - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); self::$stateTimeout = $globalConfig->getInteger('session.state.timeout', 60 * 60); } diff --git a/lib/SimpleSAML/AuthMemCookie.php b/lib/SimpleSAML/AuthMemCookie.php index 21e3e4485..17d9071a5 100644 --- a/lib/SimpleSAML/AuthMemCookie.php +++ b/lib/SimpleSAML/AuthMemCookie.php @@ -20,7 +20,7 @@ class SimpleSAML_AuthMemCookie /** - * @var SimpleSAML_Configuration The configuration for Auth MemCookie. + * @var \SimpleSAML\Configuration The configuration for Auth MemCookie. */ private $amcConfig; @@ -46,7 +46,7 @@ class SimpleSAML_AuthMemCookie private function __construct() { // load AuthMemCookie configuration - $this->amcConfig = SimpleSAML_Configuration::getConfig('authmemcookie.php'); + $this->amcConfig = \SimpleSAML\Configuration::getConfig('authmemcookie.php'); } diff --git a/lib/SimpleSAML/Bindings/Shib13/Artifact.php b/lib/SimpleSAML/Bindings/Shib13/Artifact.php index 726461aaf..32d6fc5d3 100644 --- a/lib/SimpleSAML/Bindings/Shib13/Artifact.php +++ b/lib/SimpleSAML/Bindings/Shib13/Artifact.php @@ -128,12 +128,12 @@ class Artifact /** * This function receives a SAML 1.1 artifact. * - * @param \SimpleSAML_Configuration $spMetadata The metadata of the SP. - * @param \SimpleSAML_Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. * @return string The <saml1p:Response> element, as an XML string. * @throws \SimpleSAML_Error_Exception */ - public static function receive(\SimpleSAML_Configuration $spMetadata, \SimpleSAML_Configuration $idpMetadata) + public static function receive(\SimpleSAML\Configuration $spMetadata, \SimpleSAML\Configuration $idpMetadata) { $artifacts = self::getArtifacts(); $request = self::buildRequest($artifacts); diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php index 5359c8ff3..8612816ca 100644 --- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php +++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php @@ -19,9 +19,8 @@ use SimpleSAML\XML\Signer; class HTTPPost { - /** - * @var \SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ private $configuration = null; @@ -34,11 +33,11 @@ class HTTPPost /** * Constructor for the \SimpleSAML\Bindings\Shib13\HTTPPost class. * - * @param \SimpleSAML_Configuration $configuration The configuration to use. + * @param \SimpleSAML\Configuration $configuration The configuration to use. * @param \SimpleSAML_Metadata_MetaDataStorageHandler $metadatastore A store where to find metadata. */ public function __construct( - \SimpleSAML_Configuration $configuration, + \SimpleSAML\Configuration $configuration, \SimpleSAML_Metadata_MetaDataStorageHandler $metadatastore ) { $this->configuration = $configuration; @@ -50,15 +49,15 @@ class HTTPPost * Send an authenticationResponse using HTTP-POST. * * @param string $response The response which should be sent. - * @param \SimpleSAML_Configuration $idpmd The metadata of the IdP which is sending the response. - * @param \SimpleSAML_Configuration $spmd The metadata of the SP which is receiving the response. + * @param \SimpleSAML\Configuration $idpmd The metadata of the IdP which is sending the response. + * @param \SimpleSAML\Configuration $spmd The metadata of the SP which is receiving the response. * @param string|null $relayState The relaystate for the SP. * @param string $shire The shire which should receive the response. */ public function sendResponse( $response, - \SimpleSAML_Configuration $idpmd, - \SimpleSAML_Configuration $spmd, + \SimpleSAML\Configuration $idpmd, + \SimpleSAML\Configuration $spmd, $relayState, $shire ) { diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index 1a07d4487..35ff63c2a 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -1,5 +1,7 @@ <?php +namespace SimpleSAML; + use SimpleSAML\Utils\System; /** @@ -8,7 +10,7 @@ use SimpleSAML\Utils\System; * @author Andreas Aakre Solberg, UNINETT AS. <andreas.solberg@uninett.no> * @package SimpleSAMLphp */ -class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState +class Configuration implements Utils\ClearableState { /** * A default value which means that the given option is required. @@ -100,10 +102,10 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * @param string $filename The full path of the configuration file. * @param bool $required Whether the file is required. * - * @return SimpleSAML_Configuration The configuration file. An exception will be thrown if the + * @return \SimpleSAML\Configuration The configuration file. An exception will be thrown if the * configuration file is missing. * - * @throws Exception If the configuration file is invalid or missing. + * @throws \Exception If the configuration file is invalid or missing. */ private static function loadFromFile($filename, $required) { @@ -122,9 +124,9 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState if (interface_exists('Throwable', false)) { try { require($filename); - } catch (ParseError $e) { + } catch (\ParseError $e) { self::$loadedConfigs[$filename] = self::loadFromArray(array(), '[ARRAY]', 'simplesaml'); - throw new SimpleSAML\Error\ConfigurationError($e->getMessage(), $filename, array()); + throw new Error\ConfigurationError($e->getMessage(), $filename, array()); } } else { require($filename); @@ -135,7 +137,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState // check that $config exists if (!isset($config)) { - throw new \SimpleSAML\Error\ConfigurationError( + throw new Error\ConfigurationError( '$config is not defined in the configuration file.', $filename ); @@ -143,7 +145,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState // check that $config is initialized to an array if (!is_array($config)) { - throw new \SimpleSAML\Error\ConfigurationError( + throw new Error\ConfigurationError( '$config is not an array.', $filename ); @@ -151,28 +153,28 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState // check that $config is not empty if (empty($config)) { - throw new \SimpleSAML\Error\ConfigurationError( + throw new Error\ConfigurationError( '$config is empty.', $filename ); } } elseif ($required) { // file does not exist, but is required - throw new \SimpleSAML\Error\ConfigurationError('Missing configuration file', $filename); + throw new Error\ConfigurationError('Missing configuration file', $filename); } else { // file does not exist, but is optional, so return an empty configuration object without saving it - $cfg = new SimpleSAML_Configuration(array(), $filename); + $cfg = new Configuration(array(), $filename); $cfg->filename = $filename; return $cfg; } - $cfg = new SimpleSAML_Configuration($config, $filename); + $cfg = new Configuration($config, $filename); $cfg->filename = $filename; self::$loadedConfigs[$filename] = $cfg; if ($spurious_output) { - SimpleSAML\Logger::warning( + Logger::warning( "The configuration file '$filename' generates output. Please review your configuration." ); } @@ -201,18 +203,18 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * Allows consumers to create configuration objects without having them * loaded from a file. * - * @param SimpleSAML_Configuration $config The configuration object to store + * @param \SimpleSAML\Configuration $config The configuration object to store * @param string $filename The name of the configuration file. * @param string $configSet The configuration set. Optional, defaults to 'simplesaml'. */ - public static function setPreLoadedConfig(SimpleSAML_Configuration $config, $filename = 'config.php', $configSet = 'simplesaml') + public static function setPreLoadedConfig(Configuration $config, $filename = 'config.php', $configSet = 'simplesaml') { assert(is_string($filename)); assert(is_string($configSet)); if (!array_key_exists($configSet, self::$configDirs)) { if ($configSet !== 'simplesaml') { - throw new Exception('Configuration set \'' . $configSet . '\' not initialized.'); + throw new \Exception('Configuration set \'' . $configSet . '\' not initialized.'); } else { self::$configDirs['simplesaml'] = dirname(dirname(dirname(__FILE__))) . '/config'; } @@ -231,8 +233,8 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * @param string $filename The name of the configuration file. * @param string $configSet The configuration set. Optional, defaults to 'simplesaml'. * - * @return SimpleSAML_Configuration The SimpleSAML_Configuration object. - * @throws Exception If the configuration set is not initialized. + * @return \SimpleSAML\Configuration The Configuration object. + * @throws \Exception If the configuration set is not initialized. */ public static function getConfig($filename = 'config.php', $configSet = 'simplesaml') { @@ -241,9 +243,9 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState if (!array_key_exists($configSet, self::$configDirs)) { if ($configSet !== 'simplesaml') { - throw new Exception('Configuration set \''.$configSet.'\' not initialized.'); + throw new \Exception('Configuration set \''.$configSet.'\' not initialized.'); } else { - self::$configDirs['simplesaml'] = SimpleSAML\Utils\Config::getConfigDir(); + self::$configDirs['simplesaml'] = Utils\Config::getConfigDir(); } } @@ -261,8 +263,8 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * @param string $filename The name of the configuration file. * @param string $configSet The configuration set. Optional, defaults to 'simplesaml'. * - * @return SimpleSAML_Configuration A configuration object. - * @throws Exception If the configuration set is not initialized. + * @return \SimpleSAML\Configuration A configuration object. + * @throws \Exception If the configuration set is not initialized. */ public static function getOptionalConfig($filename = 'config.php', $configSet = 'simplesaml') { @@ -271,9 +273,9 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState if (!array_key_exists($configSet, self::$configDirs)) { if ($configSet !== 'simplesaml') { - throw new Exception('Configuration set \''.$configSet.'\' not initialized.'); + throw new \Exception('Configuration set \''.$configSet.'\' not initialized.'); } else { - self::$configDirs['simplesaml'] = SimpleSAML\Utils\Config::getConfigDir(); + self::$configDirs['simplesaml'] = Utils\Config::getConfigDir(); } } @@ -292,14 +294,14 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * instance with that name will be kept for it to be retrieved later with getInstance($instance). If null, the * configuration will not be kept for later use. Defaults to null. * - * @return SimpleSAML_Configuration The configuration object. + * @return \SimpleSAML\Configuration The configuration object. */ public static function loadFromArray($config, $location = '[ARRAY]', $instance = null) { assert(is_array($config)); assert(is_string($location)); - $c = new SimpleSAML_Configuration($config, $location); + $c = new Configuration($config, $location); if ($instance !== null) { self::$instance[$instance] = $c; } @@ -318,9 +320,9 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @param string $instancename The instance name of the configuration file. Deprecated. * - * @return SimpleSAML_Configuration The configuration object. + * @return \SimpleSAML\Configuration The configuration object. * - * @throws Exception If the configuration with $instancename name is not initialized. + * @throws \Exception If the configuration with $instancename name is not initialized. */ public static function getInstance($instancename = 'simplesaml') { @@ -334,12 +336,12 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState if ($instancename === 'simplesaml') { try { return self::getConfig(); - } catch (SimpleSAML\Error\ConfigurationError $e) { - throw \SimpleSAML\Error\CriticalConfigurationError::fromException($e); + } catch (Error\ConfigurationError $e) { + throw Error\CriticalConfigurationError::fromException($e); } } - throw new \SimpleSAML\Error\CriticalConfigurationError( + throw new Error\CriticalConfigurationError( 'Configuration with name '.$instancename.' is not initialized.' ); } @@ -423,19 +425,19 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @param string $name Name of the configuration option. * @param mixed $default Default value of the configuration option. This parameter will default to null if not - * specified. This can be set to SimpleSAML_Configuration::REQUIRED_OPTION, which will + * specified. This can be set to \SimpleSAML\Configuration::REQUIRED_OPTION, which will * cause an exception to be thrown if the option isn't found. * * @return mixed The configuration option with name $name, or $default if the option was not found. * - * @throws Exception If the required option cannot be retrieved. + * @throws \Exception If the required option cannot be retrieved. */ public function getValue($name, $default = null) { // return the default value if the option is unset if (!array_key_exists($name, $this->configuration)) { if ($default === self::REQUIRED_OPTION) { - throw new Exception( + throw new \Exception( $this->location.': Could not retrieve the required option '. var_export($name, true) ); @@ -487,7 +489,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return string The absolute path relative to the root of the website. * - * @throws SimpleSAML\Error\CriticalConfigurationError If the format of 'baseurlpath' is incorrect. + * @throws \SimpleSAML\Error\CriticalConfigurationError If the format of 'baseurlpath' is incorrect. * * @deprecated This method will be removed in SimpleSAMLphp 2.0. Please use getBasePath() instead. */ @@ -495,13 +497,13 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState { if (!$this->deprecated_base_url_used) { $this->deprecated_base_url_used = true; - SimpleSAML\Logger::warning( - "SimpleSAML_Configuration::getBaseURL() is deprecated, please use getBasePath() instead." + Logger::warning( + "\SimpleSAML\Configuration::getBaseURL() is deprecated, please use getBasePath() instead." ); } if (preg_match('/^\*(.*)$/D', $this->getString('baseurlpath', 'simplesaml/'), $matches)) { // deprecated behaviour, will be removed in the future - return \SimpleSAML\Utils\HTTP::getFirstPathElement(false).$matches[1]; + return Utils\HTTP::getFirstPathElement(false).$matches[1]; } return ltrim($this->getBasePath(), '/'); } @@ -514,7 +516,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return string The absolute path where SimpleSAMLphp can be reached in the web server. * - * @throws SimpleSAML\Error\CriticalConfigurationError If the format of 'baseurlpath' is incorrect. + * @throws \SimpleSAML\Error\CriticalConfigurationError If the format of 'baseurlpath' is incorrect. */ public function getBasePath() { @@ -539,8 +541,8 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * with the configuration. Use a guessed base path instead of the one provided. */ $c = $this->toArray(); - $c['baseurlpath'] = SimpleSAML\Utils\HTTP::guessBasePath(); - throw new SimpleSAML\Error\CriticalConfigurationError( + $c['baseurlpath'] = Utils\HTTP::guessBasePath(); + throw new Error\CriticalConfigurationError( 'Incorrect format for option \'baseurlpath\'. Value is: "'. $this->getString('baseurlpath', 'simplesaml/').'". Valid format is in the form'. ' [(http|https)://(hostname|fqdn)[:port]]/[path/to/simplesaml/].', @@ -659,7 +661,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * @return boolean|mixed The option with the given name, or $default if the option isn't found and $default is * specified. * - * @throws Exception If the option is not boolean. + * @throws \Exception If the option is not boolean. */ public function getBoolean($name, $default = self::REQUIRED_OPTION) { @@ -673,7 +675,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState } if (!is_bool($ret)) { - throw new Exception( + throw new \Exception( $this->location.': The option '.var_export($name, true). ' is not a valid boolean value.' ); @@ -697,7 +699,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * @return string|mixed The option with the given name, or $default if the option isn't found and $default is * specified. * - * @throws Exception If the option is not a string. + * @throws \Exception If the option is not a string. */ public function getString($name, $default = self::REQUIRED_OPTION) { @@ -711,7 +713,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState } if (!is_string($ret)) { - throw new Exception( + throw new \Exception( $this->location.': The option '.var_export($name, true). ' is not a valid string value.' ); @@ -735,7 +737,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * @return int|mixed The option with the given name, or $default if the option isn't found and $default is * specified. * - * @throws Exception If the option is not an integer. + * @throws \Exception If the option is not an integer. */ public function getInteger($name, $default = self::REQUIRED_OPTION) { @@ -749,7 +751,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState } if (!is_int($ret)) { - throw new Exception( + throw new \Exception( $this->location.': The option '.var_export($name, true). ' is not a valid integer value.' ); @@ -777,7 +779,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * @return int|mixed The option with the given name, or $default if the option isn't found and $default is * specified. * - * @throws Exception If the option is not in the range specified. + * @throws \Exception If the option is not in the range specified. */ public function getIntegerRange($name, $minimum, $maximum, $default = self::REQUIRED_OPTION) { @@ -793,7 +795,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState } if ($ret < $minimum || $ret > $maximum) { - throw new Exception( + throw new \Exception( $this->location.': Value of option '.var_export($name, true). ' is out of range. Value is '.$ret.', allowed range is [' .$minimum.' - '.$maximum.']' @@ -823,7 +825,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return mixed The option with the given name, or $default if the option isn't found and $default is given. * - * @throws Exception If the option does not have any of the allowed values. + * @throws \Exception If the option does not have any of the allowed values. */ public function getValueValidate($name, $allowedValues, $default = self::REQUIRED_OPTION) { @@ -843,7 +845,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState } $strValues = implode(', ', $strValues); - throw new Exception( + throw new \Exception( $this->location.': Invalid value given for the option '. var_export($name, true).'. It should have one of the following values: '. $strValues.'; but it had the following value: '.var_export($ret, true) @@ -868,7 +870,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * @return array|mixed The option with the given name, or $default if the option isn't found and $default is * specified. * - * @throws Exception If the option is not an array. + * @throws \Exception If the option is not an array. */ public function getArray($name, $default = self::REQUIRED_OPTION) { @@ -882,7 +884,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState } if (!is_array($ret)) { - throw new Exception($this->location.': The option '.var_export($name, true).' is not an array.'); + throw new \Exception($this->location.': The option '.var_export($name, true).' is not an array.'); } return $ret; @@ -932,7 +934,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return array The option with the given name, or $default if the option isn't found and $default is specified. * - * @throws Exception If the option is not a string or an array of strings. + * @throws \Exception If the option is not a string or an array of strings. */ public function getArrayizeString($name, $default = self::REQUIRED_OPTION) { @@ -947,7 +949,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState foreach ($ret as $value) { if (!is_string($value)) { - throw new Exception( + throw new \Exception( $this->location.': The option '.var_export($name, true). ' must be a string or an array of strings.' ); @@ -959,9 +961,9 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState /** - * Retrieve an array as a SimpleSAML_Configuration object. + * Retrieve an array as a \SimpleSAML\Configuration object. * - * This function will load the value of an option into a SimpleSAML_Configuration object. The option must contain + * This function will load the value of an option into a \SimpleSAML\Configuration object. The option must contain * an array. * * An exception will be thrown if this option isn't an array, or if this option isn't found, and no default value @@ -974,7 +976,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return mixed The option with the given name, or $default if the option isn't found and $default is specified. * - * @throws Exception If the option is not an array. + * @throws \Exception If the option is not an array. */ public function getConfigItem($name, $default = self::REQUIRED_OPTION) { @@ -988,7 +990,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState } if (!is_array($ret)) { - throw new Exception( + throw new \Exception( $this->location.': The option '.var_export($name, true). ' is not an array.' ); @@ -999,11 +1001,11 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState /** - * Retrieve an array of arrays as an array of SimpleSAML_Configuration objects. + * Retrieve an array of arrays as an array of \SimpleSAML\Configuration objects. * * This function will retrieve an option containing an array of arrays, and create an array of - * SimpleSAML_Configuration objects from that array. The indexes in the new array will be the same as the original - * indexes, but the values will be SimpleSAML_Configuration objects. + * \SimpleSAML\Configuration objects from that array. The indexes in the new array will be the same as the original + * indexes, but the values will be \SimpleSAML\Configuration objects. * * An exception will be thrown if this option isn't an array of arrays, or if this option isn't found, and no * default value is given. @@ -1015,7 +1017,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return mixed The option with the given name, or $default if the option isn't found and $default is specified. * - * @throws Exception If the value of this element is not an array. + * @throws \Exception If the value of this element is not an array. */ public function getConfigList($name, $default = self::REQUIRED_OPTION) { @@ -1029,7 +1031,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState } if (!is_array($ret)) { - throw new Exception( + throw new \Exception( $this->location.': The option '.var_export($name, true). ' is not an array.' ); @@ -1040,7 +1042,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState $newLoc = $this->location.'['.var_export($name, true).']['. var_export($index, true).']'; if (!is_array($config)) { - throw new Exception($newLoc.': The value of this element was expected to be an array.'); + throw new \Exception($newLoc.': The value of this element was expected to be an array.'); } $out[$index] = self::loadFromArray($config, $newLoc); } @@ -1084,7 +1086,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return string The default binding. * - * @throws Exception If the default binding is missing for this endpoint type. + * @throws \Exception If the default binding is missing for this endpoint type. */ private function getDefaultBinding($endpointType) { @@ -1105,7 +1107,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState case 'shib13-sp-remote:AssertionConsumerService': return 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post'; default: - throw new Exception('Missing default binding for '.$endpointType.' in '.$set); + throw new \Exception('Missing default binding for '.$endpointType.' in '.$set); } } @@ -1117,7 +1119,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return array Array of endpoints of the given type. * - * @throws Exception If any element of the configuration options for this endpoint type is incorrect. + * @throws \Exception If any element of the configuration options for this endpoint type is incorrect. */ public function getEndpoints($endpointType) { @@ -1136,7 +1138,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState // for backwards-compatibility $eps = array($eps); } elseif (!is_array($eps)) { - throw new Exception($loc.': Expected array or string.'); + throw new \Exception($loc.': Expected array or string.'); } @@ -1154,32 +1156,32 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState $ep['ResponseLocation'] = $responseLocation; } } elseif (!is_array($ep)) { - throw new Exception($iloc.': Expected a string or an array.'); + throw new \Exception($iloc.': Expected a string or an array.'); } if (!array_key_exists('Location', $ep)) { - throw new Exception($iloc.': Missing Location.'); + throw new \Exception($iloc.': Missing Location.'); } if (!is_string($ep['Location'])) { - throw new Exception($iloc.': Location must be a string.'); + throw new \Exception($iloc.': Location must be a string.'); } if (!array_key_exists('Binding', $ep)) { - throw new Exception($iloc.': Missing Binding.'); + throw new \Exception($iloc.': Missing Binding.'); } if (!is_string($ep['Binding'])) { - throw new Exception($iloc.': Binding must be a string.'); + throw new \Exception($iloc.': Binding must be a string.'); } if (array_key_exists('ResponseLocation', $ep)) { if (!is_string($ep['ResponseLocation'])) { - throw new Exception($iloc.': ResponseLocation must be a string.'); + throw new \Exception($iloc.': ResponseLocation must be a string.'); } } if (array_key_exists('index', $ep)) { if (!is_int($ep['index'])) { - throw new Exception($iloc.': index must be an integer.'); + throw new \Exception($iloc.': index must be an integer.'); } } } @@ -1198,7 +1200,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return array|null The default endpoint, or null if no acceptable endpoints are used. * - * @throws Exception If no supported endpoint is found. + * @throws \Exception If no supported endpoint is found. */ public function getEndpointPrioritizedByBinding($endpointType, array $bindings, $default = self::REQUIRED_OPTION) { @@ -1216,7 +1218,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState if ($default === self::REQUIRED_OPTION) { $loc = $this->location.'['.var_export($endpointType, true).']:'; - throw new Exception($loc.'Could not find a supported '.$endpointType.' endpoint.'); + throw new \Exception($loc.'Could not find a supported '.$endpointType.' endpoint.'); } return $default; @@ -1233,7 +1235,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return array|null The default endpoint, or null if no acceptable endpoints are used. * - * @throws Exception If no supported endpoint is found. + * @throws \Exception If no supported endpoint is found. */ public function getDefaultEndpoint($endpointType, array $bindings = null, $default = self::REQUIRED_OPTION) { @@ -1241,14 +1243,14 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState $endpoints = $this->getEndpoints($endpointType); - $defaultEndpoint = \SimpleSAML\Utils\Config\Metadata::getDefaultEndpoint($endpoints, $bindings); + $defaultEndpoint = Utils\Config\Metadata::getDefaultEndpoint($endpoints, $bindings); if ($defaultEndpoint !== null) { return $defaultEndpoint; } if ($default === self::REQUIRED_OPTION) { $loc = $this->location.'['.var_export($endpointType, true).']:'; - throw new Exception($loc.'Could not find a supported '.$endpointType.' endpoint.'); + throw new \Exception($loc.'Could not find a supported '.$endpointType.' endpoint.'); } return $default; @@ -1266,7 +1268,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return array Associative array with language => string pairs. * - * @throws Exception If the translation is not an array or a string, or its index or value are not strings. + * @throws \Exception If the translation is not an array or a string, or its index or value are not strings. */ public function getLocalizedString($name, $default = self::REQUIRED_OPTION) { @@ -1285,15 +1287,15 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState } if (!is_array($ret)) { - throw new Exception($loc.': Must be an array or a string.'); + throw new \Exception($loc.': Must be an array or a string.'); } foreach ($ret as $k => $v) { if (!is_string($k)) { - throw new Exception($loc.': Invalid language code: '.var_export($k, true)); + throw new \Exception($loc.': Invalid language code: '.var_export($k, true)); } if (!is_string($v)) { - throw new Exception($loc.'['.var_export($v, true).']: Must be a string.'); + throw new \Exception($loc.'['.var_export($v, true).']: Must be a string.'); } } @@ -1312,8 +1314,8 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState * * @return array Public key data, or empty array if no public key or was found. * - * @throws Exception If the certificate or public key cannot be loaded from a file. - * @throws SimpleSAML_Error_Exception If the file does not contain a valid PEM-encoded certificate, or there is no + * @throws \Exception If the certificate or public key cannot be loaded from a file. + * @throws \SimpleSAML_Error_Exception If the file does not contain a valid PEM-encoded certificate, or there is no * certificate in the metadata. */ public function getPublicKeys($use = null, $required = false, $prefix = '') @@ -1347,17 +1349,17 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState ); } elseif ($this->hasValue($prefix.'certificate')) { $file = $this->getString($prefix.'certificate'); - $file = \SimpleSAML\Utils\Config::getCertPath($file); + $file = Utils\Config::getCertPath($file); $data = @file_get_contents($file); if ($data === false) { - throw new Exception($this->location.': Unable to load certificate/public key from file "'.$file.'".'); + throw new \Exception($this->location.': Unable to load certificate/public key from file "'.$file.'".'); } // extract certificate data (if this is a certificate) $pattern = '/^-----BEGIN CERTIFICATE-----([^-]*)^-----END CERTIFICATE-----/m'; if (!preg_match($pattern, $data, $matches)) { - throw new SimpleSAML_Error_Exception( + throw new \SimpleSAML_Error_Exception( $this->location.': Could not find PEM encoded certificate in "'.$file.'".' ); } @@ -1372,7 +1374,7 @@ class SimpleSAML_Configuration implements \SimpleSAML\Utils\ClearableState ), ); } elseif ($required === true) { - throw new SimpleSAML_Error_Exception($this->location.': Missing certificate in metadata.'); + throw new \SimpleSAML_Error_Exception($this->location.': Missing certificate in metadata.'); } else { return array(); } diff --git a/lib/SimpleSAML/Database.php b/lib/SimpleSAML/Database.php index 8a189386d..636e6abbd 100644 --- a/lib/SimpleSAML/Database.php +++ b/lib/SimpleSAML/Database.php @@ -1,4 +1,5 @@ <?php + namespace SimpleSAML; /** @@ -18,7 +19,6 @@ namespace SimpleSAML; class Database { - /** * This variable holds the instance of the session - Singleton approach. */ @@ -48,13 +48,13 @@ class Database /** * Retrieves the current database instance. Will create a new one if there isn't an existing connection. * - * @param \SimpleSAML_Configuration $altConfig Optional: Instance of a SimpleSAML_Configuration class + * @param \SimpleSAML\Configuration $altConfig Optional: Instance of a \SimpleSAML\Configuration class * * @return \SimpleSAML\Database The shared database connection. */ public static function getInstance($altConfig = null) { - $config = ($altConfig) ? $altConfig : \SimpleSAML_Configuration::getInstance(); + $config = ($altConfig) ? $altConfig : Configuration::getInstance(); $instanceId = self::generateInstanceId($config); // check if we already have initialized the session @@ -71,7 +71,7 @@ class Database /** * Private constructor that restricts instantiation to getInstance(). * - * @param \SimpleSAML_Configuration $config Instance of the SimpleSAML_Configuration class + * @param \SimpleSAML\Configuration $config Instance of the \SimpleSAML\Configuration class */ private function __construct($config) { @@ -109,7 +109,7 @@ class Database /** * Generate an Instance ID based on the database configuration. * - * @param \SimpleSAML_Configuration $config Configuration class + * @param \SimpleSAML\Configuration $config Configuration class * * @return string $instanceId */ diff --git a/lib/SimpleSAML/Error/CriticalConfigurationError.php b/lib/SimpleSAML/Error/CriticalConfigurationError.php index 507fd2bf2..d8662c0e8 100644 --- a/lib/SimpleSAML/Error/CriticalConfigurationError.php +++ b/lib/SimpleSAML/Error/CriticalConfigurationError.php @@ -1,4 +1,5 @@ <?php + /** * This exception represents a configuration error that we cannot recover from. * @@ -50,7 +51,7 @@ class CriticalConfigurationError extends ConfigurationError $config['baseurlpath'] = \SimpleSAML\Utils\HTTP::guessBasePath(); } - \SimpleSAML_Configuration::loadFromArray( + \SimpleSAML\Configuration::loadFromArray( $config, '', 'simplesaml' diff --git a/lib/SimpleSAML/Error/Error.php b/lib/SimpleSAML/Error/Error.php index 55b47a460..b192935d9 100644 --- a/lib/SimpleSAML/Error/Error.php +++ b/lib/SimpleSAML/Error/Error.php @@ -204,7 +204,7 @@ class SimpleSAML_Error_Error extends SimpleSAML_Error_Exception $reportId = bin2hex(openssl_random_pseudo_bytes(4)); SimpleSAML\Logger::error('Error report with id '.$reportId.' generated.'); - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); if (isset($_SERVER['HTTP_REFERER'])) { @@ -245,7 +245,7 @@ class SimpleSAML_Error_Error extends SimpleSAML_Error_Exception $this->logError(); $errorData = $this->saveError(); - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $data = array(); $data['showerrors'] = $config->getBoolean('showerrors', true); diff --git a/lib/SimpleSAML/Error/Exception.php b/lib/SimpleSAML/Error/Exception.php index 6d7efcc73..844068cec 100644 --- a/lib/SimpleSAML/Error/Exception.php +++ b/lib/SimpleSAML/Error/Exception.php @@ -168,7 +168,7 @@ class SimpleSAML_Error_Exception extends Exception public function formatBacktrace($anonymize = false) { $ret = array(); - $basedir = SimpleSAML_Configuration::getInstance()->getBaseDir(); + $basedir = \SimpleSAML\Configuration::getInstance()->getBaseDir(); $e = $this; do { @@ -198,7 +198,7 @@ class SimpleSAML_Error_Exception extends Exception protected function logBacktrace($level = \SimpleSAML\Logger::DEBUG) { // see if debugging is enabled for backtraces - $debug = SimpleSAML_Configuration::getInstance()->getArrayize('debug', array('backtraces' => false)); + $debug = \SimpleSAML\Configuration::getInstance()->getArrayize('debug', array('backtraces' => false)); if (!(in_array('backtraces', $debug, true) // implicitly enabled || (array_key_exists('backtraces', $debug) && $debug['backtraces'] === true) // explicitly set diff --git a/lib/SimpleSAML/IdP.php b/lib/SimpleSAML/IdP.php index 42a57ae9e..fc5abfc72 100644 --- a/lib/SimpleSAML/IdP.php +++ b/lib/SimpleSAML/IdP.php @@ -36,7 +36,7 @@ class SimpleSAML_IdP /** * The configuration for this IdP. * - * @var SimpleSAML_Configuration + * @var SimpleSAML\Configuration */ private $config; @@ -61,7 +61,7 @@ class SimpleSAML_IdP $this->id = $id; $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = SimpleSAML\Configuration::getInstance(); if (substr($id, 0, 6) === 'saml2:') { if (!$globalConfig->getBoolean('enable.saml20-idp', false)) { @@ -153,7 +153,7 @@ class SimpleSAML_IdP /** * Retrieve the configuration for this IdP. * - * @return SimpleSAML_Configuration The configuration object. + * @return SimpleSAML\Configuration The configuration object. */ public function getConfig() { diff --git a/lib/SimpleSAML/Locale/Language.php b/lib/SimpleSAML/Locale/Language.php index 9e5696cec..9e893c113 100644 --- a/lib/SimpleSAML/Locale/Language.php +++ b/lib/SimpleSAML/Locale/Language.php @@ -23,7 +23,7 @@ class Language /** * The configuration to use. * - * @var \SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ private $configuration; @@ -133,9 +133,9 @@ class Language /** * Constructor * - * @param \SimpleSAML_Configuration $configuration Configuration object + * @param \SimpleSAML\Configuration $configuration Configuration object */ - public function __construct(\SimpleSAML_Configuration $configuration) + public function __construct(\SimpleSAML\Configuration $configuration) { $this->configuration = $configuration; $this->availableLanguages = $this->getInstalledLanguages(); @@ -376,7 +376,7 @@ class Language */ public static function getLanguageCookie() { - $config = \SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $availableLanguages = $config->getArray('language.available', array('en')); $name = $config->getString('language.cookie.name', 'language'); @@ -402,7 +402,7 @@ class Language assert(is_string($language)); $language = strtolower($language); - $config = \SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $availableLanguages = $config->getArray('language.available', array('en')); if (!in_array($language, $availableLanguages, true) || headers_sent()) { diff --git a/lib/SimpleSAML/Locale/Localization.php b/lib/SimpleSAML/Locale/Localization.php index 9a023f9b4..355d9594a 100644 --- a/lib/SimpleSAML/Locale/Localization.php +++ b/lib/SimpleSAML/Locale/Localization.php @@ -17,7 +17,7 @@ class Localization /** * The configuration to use. * - * @var \SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ private $configuration; @@ -70,9 +70,9 @@ class Localization /** * Constructor * - * @param \SimpleSAML_Configuration $configuration Configuration object + * @param \SimpleSAML\Configuration $configuration Configuration object */ - public function __construct(\SimpleSAML_Configuration $configuration) + public function __construct(\SimpleSAML\Configuration $configuration) { $this->configuration = $configuration; $this->localeDir = $this->configuration->resolvePath('locales'); diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php index 00ac6e5ee..e96cd78f1 100644 --- a/lib/SimpleSAML/Locale/Translate.php +++ b/lib/SimpleSAML/Locale/Translate.php @@ -12,11 +12,10 @@ namespace SimpleSAML\Locale; class Translate { - /** * The configuration to be used for this translator. * - * @var \SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ private $configuration; @@ -43,10 +42,10 @@ class Translate /** * Constructor * - * @param \SimpleSAML_Configuration $configuration Configuration object + * @param \SimpleSAML\Configuration $configuration Configuration object * @param string|null $defaultDictionary The default dictionary where tags will come from. */ - public function __construct(\SimpleSAML_Configuration $configuration, $defaultDictionary = null) + public function __construct(\SimpleSAML\Configuration $configuration, $defaultDictionary = null) { $this->configuration = $configuration; $this->language = new Language($configuration); @@ -369,7 +368,7 @@ class Translate * Include a language file from the dictionaries directory. * * @param string $file File name of dictionary to include - * @param \SimpleSAML_Configuration|null $otherConfig Optionally provide a different configuration object than the + * @param \SimpleSAML\Configuration|null $otherConfig Optionally provide a different configuration object than the * one provided in the constructor to be used to find the directory of the dictionary. This allows to combine * dictionaries inside the SimpleSAMLphp main code distribution together with external dictionaries. Defaults to * null. @@ -527,10 +526,10 @@ class Translate } // we don't have a translation for the current language, load alternative priorities - $sspcfg = \SimpleSAML_Configuration::getInstance(); + $sspcfg = \SimpleSAML\Configuration::getInstance(); $langcfg = $sspcfg->getConfigItem('language', null); $priorities = array(); - if ($langcfg instanceof \SimpleSAML_Configuration) { + if ($langcfg instanceof \SimpleSAML\Configuration) { $priorities = $langcfg->getArray('priorities', array()); } diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php index 4f6b7a9c7..f98451de3 100644 --- a/lib/SimpleSAML/Logger.php +++ b/lib/SimpleSAML/Logger.php @@ -360,8 +360,8 @@ class Logger ); // get the configuration - $config = \SimpleSAML_Configuration::getInstance(); - assert($config instanceof \SimpleSAML_Configuration); + $config = Configuration::getInstance(); + assert($config instanceof Configuration); // setting minimum log_level self::$logLevel = $config->getInteger('logging.level', self::INFO); diff --git a/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php b/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php index 845103cf2..9af1f63bc 100644 --- a/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php +++ b/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php @@ -14,7 +14,6 @@ use SimpleSAML\Logger; */ class ErrorLogLoggingHandler implements LoggingHandlerInterface { - /** * This array contains the mappings from syslog log level to names. */ @@ -40,9 +39,9 @@ class ErrorLogLoggingHandler implements LoggingHandlerInterface /** * ErrorLogLoggingHandler constructor. * - * @param \SimpleSAML_Configuration $config The configuration object for this handler. + * @param \SimpleSAML\Configuration $config The configuration object for this handler. */ - public function __construct(\SimpleSAML_Configuration $config) + public function __construct(\SimpleSAML\Configuration $config) { $this->processname = $config->getString('logging.processname', 'SimpleSAMLphp'); } diff --git a/lib/SimpleSAML/Logger/FileLoggingHandler.php b/lib/SimpleSAML/Logger/FileLoggingHandler.php index 475541f1b..522c17979 100644 --- a/lib/SimpleSAML/Logger/FileLoggingHandler.php +++ b/lib/SimpleSAML/Logger/FileLoggingHandler.php @@ -42,7 +42,7 @@ class FileLoggingHandler implements LoggingHandlerInterface /** * Build a new logging handler based on files. */ - public function __construct(\SimpleSAML_Configuration $config) + public function __construct(\SimpleSAML\Configuration $config) { // get the metadata handler option from the configuration $this->logFile = $config->getPathValue('loggingdir', 'log/'). diff --git a/lib/SimpleSAML/Logger/LoggingHandlerInterface.php b/lib/SimpleSAML/Logger/LoggingHandlerInterface.php index c7b00eb01..a9b939ddd 100644 --- a/lib/SimpleSAML/Logger/LoggingHandlerInterface.php +++ b/lib/SimpleSAML/Logger/LoggingHandlerInterface.php @@ -13,11 +13,11 @@ interface LoggingHandlerInterface { /** - * Constructor for log handlers. It must accept receiving a \SimpleSAML_Configuration object. + * Constructor for log handlers. It must accept receiving a \SimpleSAML\Configuration object. * - * @param \SimpleSAML_Configuration $config The configuration to use in this log handler. + * @param \SimpleSAML\Configuration $config The configuration to use in this log handler. */ - public function __construct(\SimpleSAML_Configuration $config); + public function __construct(\SimpleSAML\Configuration $config); /** diff --git a/lib/SimpleSAML/Logger/StandardErrorLoggingHandler.php b/lib/SimpleSAML/Logger/StandardErrorLoggingHandler.php index 0f35fcf54..3413e68ce 100644 --- a/lib/SimpleSAML/Logger/StandardErrorLoggingHandler.php +++ b/lib/SimpleSAML/Logger/StandardErrorLoggingHandler.php @@ -16,7 +16,7 @@ class StandardErrorLoggingHandler extends FileLoggingHandler * * It runs the parent constructor and sets the log file to be the standard error descriptor. */ - public function __construct(\SimpleSAML_Configuration $config) + public function __construct(\SimpleSAML\Configuration $config) { $this->processname = $config->getString('logging.processname', 'SimpleSAMLphp'); $this->logFile = 'php://stderr'; diff --git a/lib/SimpleSAML/Logger/SyslogLoggingHandler.php b/lib/SimpleSAML/Logger/SyslogLoggingHandler.php index ce2739798..0330c3d13 100644 --- a/lib/SimpleSAML/Logger/SyslogLoggingHandler.php +++ b/lib/SimpleSAML/Logger/SyslogLoggingHandler.php @@ -20,7 +20,7 @@ class SyslogLoggingHandler implements LoggingHandlerInterface /** * Build a new logging handler based on syslog. */ - public function __construct(\SimpleSAML_Configuration $config) + public function __construct(\SimpleSAML\Configuration $config) { $facility = $config->getInteger('logging.facility', defined('LOG_LOCAL5') ? constant('LOG_LOCAL5') : LOG_USER); diff --git a/lib/SimpleSAML/Memcache.php b/lib/SimpleSAML/Memcache.php index 3f4bba004..46933304c 100644 --- a/lib/SimpleSAML/Memcache.php +++ b/lib/SimpleSAML/Memcache.php @@ -364,7 +364,7 @@ class SimpleSAML_Memcache self::$serverGroups = array(); // load the configuration - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $groups = $config->getArray('memcache_store.servers'); @@ -415,8 +415,8 @@ class SimpleSAML_Memcache private static function getExpireTime() { // get the configuration instance - $config = SimpleSAML_Configuration::getInstance(); - assert($config instanceof SimpleSAML_Configuration); + $config = \SimpleSAML\Configuration::getInstance(); + assert($config instanceof \SimpleSAML\Configuration); // get the expire-value from the configuration $expire = $config->getInteger('memcache_store.expires', 0); diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php index 609147022..d5fdc6de2 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php @@ -53,7 +53,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandler */ protected function __construct() { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $sourcesConfig = $config->getArray('metadata.sources', null); @@ -95,8 +95,8 @@ class SimpleSAML_Metadata_MetaDataStorageHandler } // get the configuration - $config = SimpleSAML_Configuration::getInstance(); - assert($config instanceof SimpleSAML_Configuration); + $config = \SimpleSAML\Configuration::getInstance(); + assert($config instanceof \SimpleSAML\Configuration); $baseurl = \SimpleSAML\Utils\HTTP::getSelfURLHost().$config->getBasePath(); @@ -308,7 +308,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandler * @param string $entityId The entity ID we are looking up. * @param string $set The metadata set we are searching. * - * @return SimpleSAML_Configuration The configuration object representing the metadata. + * @return \SimpleSAML\Configuration The configuration object representing the metadata. * @throws SimpleSAML_Error_MetadataNotFound If no metadata for the entity specified can be found. */ public function getMetaDataConfig($entityId, $set) @@ -317,7 +317,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandler assert(is_string($set)); $metadata = $this->getMetaData($entityId, $set); - return SimpleSAML_Configuration::loadFromArray($metadata, $set.'/'.var_export($entityId, true)); + return \SimpleSAML\Configuration::loadFromArray($metadata, $set.'/'.var_export($entityId, true)); } @@ -327,7 +327,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandler * @param string $sha1 The SHA1 digest of the entity ID. * @param string $set The metadata set we are searching. * - * @return null|SimpleSAML_Configuration The metadata corresponding to the entity, or null if the entity cannot be + * @return null|\SimpleSAML\Configuration The metadata corresponding to the entity, or null if the entity cannot be * found. */ public function getMetaDataConfigForSha1($sha1, $set) @@ -349,7 +349,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandler if (sha1($remote_provider['entityid']) == $sha1) { $remote_provider['metadata-set'] = $set; - return SimpleSAML_Configuration::loadFromArray( + return \SimpleSAML\Configuration::loadFromArray( $remote_provider, $set.'/'.var_export($remote_provider['entityid'], true) ); diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php index 09ce8b289..9183284c0 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php @@ -43,7 +43,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerFlatFile extends SimpleSAML_Meta assert(is_array($config)); // get the configuration - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); // find the path to the directory we should search for metadata in if (array_key_exists('directory', $config)) { diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php index 686791152..0a1ee73a5 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php @@ -36,9 +36,9 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met { assert(is_array($config)); - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); - $cfgHelp = SimpleSAML_Configuration::loadFromArray($config, 'serialize metadata source'); + $cfgHelp = \SimpleSAML\Configuration::loadFromArray($config, 'serialize metadata source'); $this->directory = $cfgHelp->getString('directory'); diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php index 7e2b50509..49e238412 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php @@ -35,7 +35,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerXML extends SimpleSAML_Metadata_ $src = $srcXml = null; if (array_key_exists('file', $config)) { // get the configuration - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $src = $globalConfig->resolvePath($config['file']); } elseif (array_key_exists('url', $config)) { $src = $config['url']; diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index ba584c567..60bd0d157 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -120,7 +120,7 @@ class SimpleSAML_Metadata_SAMLBuilder assert(isset($metadata['entityid'])); assert(isset($metadata['metadata-set'])); - $metadata = SimpleSAML_Configuration::loadFromArray($metadata, $metadata['entityid']); + $metadata = \SimpleSAML\Configuration::loadFromArray($metadata, $metadata['entityid']); $defaultEndpoint = $metadata->getDefaultEndpoint('SingleSignOnService'); $e = new sspmod_adfs_SAML2_XML_fed_SecurityTokenServiceType(); $e->Location = $defaultEndpoint['Location']; @@ -134,10 +134,10 @@ class SimpleSAML_Metadata_SAMLBuilder /** * Add extensions to the metadata. * - * @param SimpleSAML_Configuration $metadata The metadata to get extensions from. + * @param \SimpleSAML\Configuration $metadata The metadata to get extensions from. * @param \SAML2\XML\md\RoleDescriptor $e Reference to the element where the Extensions element should be included. */ - private function addExtensions(SimpleSAML_Configuration $metadata, \SAML2\XML\md\RoleDescriptor $e) + private function addExtensions(\SimpleSAML\Configuration $metadata, \SAML2\XML\md\RoleDescriptor $e) { if ($metadata->hasValue('tags')) { $a = new \SAML2\XML\saml\Attribute(); @@ -380,11 +380,11 @@ class SimpleSAML_Metadata_SAMLBuilder * Add an AttributeConsumingService element to the metadata. * * @param \SAML2\XML\md\SPSSODescriptor $spDesc The SPSSODescriptor element. - * @param SimpleSAML_Configuration $metadata The metadata. + * @param \SimpleSAML\Configuration $metadata The metadata. */ private function addAttributeConsumingService( \SAML2\XML\md\SPSSODescriptor $spDesc, - SimpleSAML_Configuration $metadata + \SimpleSAML\Configuration $metadata ) { $attributes = $metadata->getArray('attributes', array()); $name = $metadata->getLocalizedString('name', null); @@ -479,7 +479,7 @@ class SimpleSAML_Metadata_SAMLBuilder assert(isset($metadata['entityid'])); assert(isset($metadata['metadata-set'])); - $metadata = SimpleSAML_Configuration::loadFromArray($metadata, $metadata['entityid']); + $metadata = \SimpleSAML\Configuration::loadFromArray($metadata, $metadata['entityid']); $e = new \SAML2\XML\md\SPSSODescriptor(); $e->protocolSupportEnumeration = $protocols; @@ -534,7 +534,7 @@ class SimpleSAML_Metadata_SAMLBuilder assert(isset($metadata['entityid'])); assert(isset($metadata['metadata-set'])); - $metadata = SimpleSAML_Configuration::loadFromArray($metadata, $metadata['entityid']); + $metadata = \SimpleSAML\Configuration::loadFromArray($metadata, $metadata['entityid']); $e = new \SAML2\XML\md\IDPSSODescriptor(); $e->protocolSupportEnumeration[] = 'urn:oasis:names:tc:SAML:2.0:protocol'; @@ -583,7 +583,7 @@ class SimpleSAML_Metadata_SAMLBuilder assert(isset($metadata['entityid'])); assert(isset($metadata['metadata-set'])); - $metadata = SimpleSAML_Configuration::loadFromArray($metadata, $metadata['entityid']); + $metadata = \SimpleSAML\Configuration::loadFromArray($metadata, $metadata['entityid']); $e = new \SAML2\XML\md\SPSSODescriptor(); $e->protocolSupportEnumeration[] = 'urn:oasis:names:tc:SAML:1.1:protocol'; @@ -618,7 +618,7 @@ class SimpleSAML_Metadata_SAMLBuilder assert(isset($metadata['entityid'])); assert(isset($metadata['metadata-set'])); - $metadata = SimpleSAML_Configuration::loadFromArray($metadata, $metadata['entityid']); + $metadata = \SimpleSAML\Configuration::loadFromArray($metadata, $metadata['entityid']); $e = new \SAML2\XML\md\IDPSSODescriptor(); $e->protocolSupportEnumeration[] = 'urn:oasis:names:tc:SAML:1.1:protocol'; @@ -646,7 +646,7 @@ class SimpleSAML_Metadata_SAMLBuilder assert(isset($metadata['entityid'])); assert(isset($metadata['metadata-set'])); - $metadata = SimpleSAML_Configuration::loadFromArray($metadata, $metadata['entityid']); + $metadata = \SimpleSAML\Configuration::loadFromArray($metadata, $metadata['entityid']); $e = new \SAML2\XML\md\AttributeAuthorityDescriptor(); $e->protocolSupportEnumeration = $metadata->getArray('protocols', array(\SAML2\Constants::NS_SAMLP)); @@ -753,9 +753,9 @@ class SimpleSAML_Metadata_SAMLBuilder * Helper function for adding a certificate to the metadata. * * @param \SAML2\XML\md\RoleDescriptor $rd The RoleDescriptor the certificate should be added to. - * @param SimpleSAML_Configuration $metadata The metadata of the entity. + * @param \SimpleSAML\Configuration $metadata The metadata of the entity. */ - private function addCertificate(\SAML2\XML\md\RoleDescriptor $rd, SimpleSAML_Configuration $metadata) + private function addCertificate(\SAML2\XML\md\RoleDescriptor $rd, \SimpleSAML\Configuration $metadata) { $keys = $metadata->getPublicKeys(); foreach ($keys as $key) { diff --git a/lib/SimpleSAML/Metadata/Signer.php b/lib/SimpleSAML/Metadata/Signer.php index 98bfbbe8f..25f7a2e42 100644 --- a/lib/SimpleSAML/Metadata/Signer.php +++ b/lib/SimpleSAML/Metadata/Signer.php @@ -14,9 +14,9 @@ class SimpleSAML_Metadata_Signer * This functions finds what key & certificate files should be used to sign the metadata * for the given entity. * - * @param SimpleSAML_Configuration $config Our SimpleSAML_Configuration instance. - * @param array $entityMetadata The metadata of the entity. - * @param string $type A string which describes the type entity this is, e.g. 'SAML 2 IdP' or + * @param \SimpleSAML\Configuration $config Our \SimpleSAML\Configuration instance. + * @param array $entityMetadata The metadata of the entity. + * @param string $type A string which describes the type entity this is, e.g. 'SAML 2 IdP' or * 'Shib 1.3 SP'. * * @return array An associative array with the keys 'privatekey', 'certificate', and optionally 'privatekey_pass'. @@ -110,9 +110,9 @@ class SimpleSAML_Metadata_Signer /** * Determine whether metadata signing is enabled for the given metadata. * - * @param SimpleSAML_Configuration $config Our SimpleSAML_Configuration instance. - * @param array $entityMetadata The metadata of the entity. - * @param string $type A string which describes the type entity this is, e.g. 'SAML 2 IdP' or + * @param \SimpleSAML\Configuration $config Our \SimpleSAML\Configuration instance. + * @param array $entityMetadata The metadata of the entity. + * @param string $type A string which describes the type entity this is, e.g. 'SAML 2 IdP' or * 'Shib 1.3 SP'. * * @return boolean True if metadata signing is enabled, false otherwise. @@ -145,7 +145,7 @@ class SimpleSAML_Metadata_Signer * This method will look for the 'metadata.sign.algorithm' key in the $entityMetadata array, or look for such * a configuration option in the $config object. * - * @param SimpleSAML_Configuration $config The global configuration. + * @param \SimpleSAML\Configuration $config The global configuration. * @param array $entityMetadata An array containing the metadata related to this entity. * @param string $type A string describing the type of entity. E.g. 'SAML 2 IdP' or 'Shib 1.3 SP'. * @@ -213,7 +213,7 @@ class SimpleSAML_Metadata_Signer */ public static function sign($metadataString, $entityMetadata, $type) { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); // check if metadata signing is enabled if (!self::isMetadataSigningEnabled($config, $entityMetadata, $type)) { diff --git a/lib/SimpleSAML/Metadata/Sources/MDQ.php b/lib/SimpleSAML/Metadata/Sources/MDQ.php index 975f79246..ba61c2cb2 100644 --- a/lib/SimpleSAML/Metadata/Sources/MDQ.php +++ b/lib/SimpleSAML/Metadata/Sources/MDQ.php @@ -80,7 +80,7 @@ class MDQ extends \SimpleSAML_Metadata_MetaDataStorageSource } if (array_key_exists('cachedir', $config)) { - $globalConfig = \SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $this->cacheDir = $globalConfig->resolvePath($config['cachedir']); } else { $this->cacheDir = null; diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php index 6c9b3c6e0..a921fa739 100644 --- a/lib/SimpleSAML/Module.php +++ b/lib/SimpleSAML/Module.php @@ -1,4 +1,5 @@ <?php + namespace SimpleSAML; /** @@ -58,7 +59,7 @@ class Module */ public static function isModuleEnabled($module) { - $config = \SimpleSAML_Configuration::getOptionalConfig(); + $config = Configuration::getOptionalConfig(); return self::isModuleEnabledWithConf($module, $config->getArray('module.enable', array())); } @@ -283,7 +284,7 @@ class Module assert(is_string($hook)); $modules = self::getModules(); - $config = \SimpleSAML_Configuration::getOptionalConfig()->getArray('module.enable', array()); + $config = Configuration::getOptionalConfig()->getArray('module.enable', array()); sort($modules); foreach ($modules as $module) { if (!self::isModuleEnabledWithConf($module, $config)) { diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index 17e035732..91af0e5a8 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -175,7 +175,7 @@ class SimpleSAML_Session implements Serializable $this->markDirty(); // initialize data for session check function if defined - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $checkFunction = $globalConfig->getArray('session.check_function', null); if (isset($checkFunction)) { assert(is_callable($checkFunction)); @@ -287,7 +287,7 @@ class SimpleSAML_Session implements Serializable self::load(new SimpleSAML_Session()); } catch (\SimpleSAML\Error\CannotSetCookie $e) { // can't create a regular session because we can't set cookies. Use transient. - $c = SimpleSAML_Configuration::getInstance(); + $c = \SimpleSAML\Configuration::getInstance(); self::useTransientSession(); if ($e->getCode() === \SimpleSAML\Error\CannotSetCookie::SECURE_COOKIE) { @@ -340,7 +340,7 @@ class SimpleSAML_Session implements Serializable assert($session instanceof self); if ($checkToken) { - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); if ($session->authToken !== null) { $authTokenCookieName = $globalConfig->getString( @@ -550,7 +550,7 @@ class SimpleSAML_Session implements Serializable assert(is_int($expire) || $expire === null); if ($expire === null) { - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $expire = time() + $globalConfig->getInteger('session.rememberme.lifetime', 14 * 86400); } $this->rememberMeExpire = $expire; @@ -589,7 +589,7 @@ class SimpleSAML_Session implements Serializable $data['Authority'] = $authority; - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); if (!isset($data['AuthnInstant'])) { $data['AuthnInstant'] = time(); } @@ -763,7 +763,7 @@ class SimpleSAML_Session implements Serializable $params = array_merge($sessionHandler->getCookieParams(), is_array($params) ? $params : array()); if ($this->authToken !== null) { - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); \SimpleSAML\Utils\HTTP::setCookie( $globalConfig->getString('session.authtoken.cookiename', 'SimpleSAMLAuthToken'), $this->authToken, @@ -786,7 +786,7 @@ class SimpleSAML_Session implements Serializable $this->markDirty(); if ($expire === null) { - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $expire = time() + $globalConfig->getInteger('session.duration', 8 * 60 * 60); } @@ -871,7 +871,7 @@ class SimpleSAML_Session implements Serializable if ($timeout === null) { // use the default timeout - $configuration = SimpleSAML_Configuration::getInstance(); + $configuration = \SimpleSAML\Configuration::getInstance(); $timeout = $configuration->getInteger('session.datastore.timeout', null); if ($timeout !== null) { diff --git a/lib/SimpleSAML/SessionHandler.php b/lib/SimpleSAML/SessionHandler.php index a8d4ad0ef..4608e3cb6 100644 --- a/lib/SimpleSAML/SessionHandler.php +++ b/lib/SimpleSAML/SessionHandler.php @@ -147,7 +147,7 @@ abstract class SessionHandler */ public function getCookieParams() { - $config = \SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); return array( 'lifetime' => $config->getInteger('session.cookie.lifetime', 0), diff --git a/lib/SimpleSAML/SessionHandlerCookie.php b/lib/SimpleSAML/SessionHandlerCookie.php index b94e8f716..c0bb2e8df 100644 --- a/lib/SimpleSAML/SessionHandlerCookie.php +++ b/lib/SimpleSAML/SessionHandlerCookie.php @@ -44,7 +44,7 @@ abstract class SessionHandlerCookie extends SessionHandler // call the constructor in the base class in case it should become necessary in the future parent::__construct(); - $config = \SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); $this->cookie_name = $config->getString('session.cookie.name', 'SimpleSAMLSessionID'); } diff --git a/lib/SimpleSAML/SessionHandlerPHP.php b/lib/SimpleSAML/SessionHandlerPHP.php index 30f3d909a..8b0904dab 100644 --- a/lib/SimpleSAML/SessionHandlerPHP.php +++ b/lib/SimpleSAML/SessionHandlerPHP.php @@ -46,7 +46,7 @@ class SessionHandlerPHP extends SessionHandler // call the parent constructor in case it should become necessary in the future parent::__construct(); - $config = \SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); $this->cookie_name = $config->getString('session.phpsession.cookiename', null); if (session_status() === PHP_SESSION_ACTIVE) { @@ -293,7 +293,7 @@ class SessionHandlerPHP extends SessionHandler */ public function getCookieParams() { - $config = \SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); $ret = parent::getCookieParams(); diff --git a/lib/SimpleSAML/SessionHandlerStore.php b/lib/SimpleSAML/SessionHandlerStore.php index 328654249..108655641 100644 --- a/lib/SimpleSAML/SessionHandlerStore.php +++ b/lib/SimpleSAML/SessionHandlerStore.php @@ -71,7 +71,7 @@ class SessionHandlerStore extends SessionHandlerCookie { $sessionId = $session->getSessionId(); - $config = \SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); $sessionDuration = $config->getInteger('session.duration', 8 * 60 * 60); $expire = time() + $sessionDuration; diff --git a/lib/SimpleSAML/Stats.php b/lib/SimpleSAML/Stats.php index 36b6f6626..3cd010f2e 100644 --- a/lib/SimpleSAML/Stats.php +++ b/lib/SimpleSAML/Stats.php @@ -30,11 +30,11 @@ class SimpleSAML_Stats /** * Create an output from a configuration object. * - * @param SimpleSAML_Configuration $config The configuration object. + * @param \SimpleSAML\Configuration $config The configuration object. * * @return mixed A new instance of the configured class. */ - private static function createOutput(SimpleSAML_Configuration $config) + private static function createOutput(\SimpleSAML\Configuration $config) { $cls = $config->getString('class'); $cls = SimpleSAML\Module::resolveClass($cls, 'Stats_Output', 'SimpleSAML_Stats_Output'); @@ -50,7 +50,7 @@ class SimpleSAML_Stats private static function initOutputs() { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $outputCfgs = $config->getConfigList('statistics.out', array()); self::$outputs = array(); diff --git a/lib/SimpleSAML/Stats/Output.php b/lib/SimpleSAML/Stats/Output.php index 8b019c8c9..fe803e9bf 100644 --- a/lib/SimpleSAML/Stats/Output.php +++ b/lib/SimpleSAML/Stats/Output.php @@ -12,9 +12,9 @@ abstract class SimpleSAML_Stats_Output /** * Initialize the output. * - * @param SimpleSAML_Configuration $config The configuration for this output. + * @param \SimpleSAML\Configuration $config The configuration for this output. */ - public function __construct(SimpleSAML_Configuration $config) + public function __construct(\SimpleSAML\Configuration $config) { // do nothing by default } diff --git a/lib/SimpleSAML/Store.php b/lib/SimpleSAML/Store.php index 8f25b59c9..3beb66eba 100644 --- a/lib/SimpleSAML/Store.php +++ b/lib/SimpleSAML/Store.php @@ -34,7 +34,7 @@ abstract class Store return self::$instance; } - $config = \SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); $storeType = $config->getString('store.type', null); if ($storeType === null) { $storeType = $config->getString('session.handler', 'phpsession'); diff --git a/lib/SimpleSAML/Store/Memcache.php b/lib/SimpleSAML/Store/Memcache.php index 8f9fcfbea..db6d02f74 100644 --- a/lib/SimpleSAML/Store/Memcache.php +++ b/lib/SimpleSAML/Store/Memcache.php @@ -2,7 +2,7 @@ namespace SimpleSAML\Store; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\Store; /** diff --git a/lib/SimpleSAML/Store/Redis.php b/lib/SimpleSAML/Store/Redis.php index d102b01fd..1841670ba 100644 --- a/lib/SimpleSAML/Store/Redis.php +++ b/lib/SimpleSAML/Store/Redis.php @@ -2,7 +2,7 @@ namespace SimpleSAML\Store; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\Store; /** diff --git a/lib/SimpleSAML/Store/SQL.php b/lib/SimpleSAML/Store/SQL.php index adfa6b56e..eaae0c5c5 100644 --- a/lib/SimpleSAML/Store/SQL.php +++ b/lib/SimpleSAML/Store/SQL.php @@ -2,7 +2,7 @@ namespace SimpleSAML\Store; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\Logger; use \SimpleSAML\Store; diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 68cd10b87..b7608ac38 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -463,7 +463,7 @@ class SimpleSAML_Utilities /** * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\Crypto::loadPublicKey() instead. */ - public static function loadPublicKey(SimpleSAML_Configuration $metadata, $required = false, $prefix = '') + public static function loadPublicKey(\SimpleSAML\Configuration $metadata, $required = false, $prefix = '') { return SimpleSAML\Utils\Crypto::loadPublicKey($metadata, $required, $prefix); } @@ -472,7 +472,7 @@ class SimpleSAML_Utilities /** * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\Crypto::loadPrivateKey() instead. */ - public static function loadPrivateKey(SimpleSAML_Configuration $metadata, $required = false, $prefix = '') + public static function loadPrivateKey(\SimpleSAML\Configuration $metadata, $required = false, $prefix = '') { return SimpleSAML\Utils\Crypto::loadPrivateKey($metadata, $required, $prefix); } diff --git a/lib/SimpleSAML/Utils/Config.php b/lib/SimpleSAML/Utils/Config.php index 862fbebb4..77cdd0b25 100644 --- a/lib/SimpleSAML/Utils/Config.php +++ b/lib/SimpleSAML/Utils/Config.php @@ -25,7 +25,7 @@ class Config throw new \InvalidArgumentException('Invalid input parameters.'); } - $globalConfig = \SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $base = $globalConfig->getPathValue('certdir', 'cert/'); return System::resolvePath($path, $base); } @@ -48,7 +48,7 @@ class Config */ public static function getSecretSalt() { - $secretSalt = \SimpleSAML_Configuration::getInstance()->getString('secretsalt'); + $secretSalt = \SimpleSAML\Configuration::getInstance()->getString('secretsalt'); if ($secretSalt === 'defaultsecretsalt') { throw new \InvalidArgumentException('The "secretsalt" configuration option must be set to a secret value.'); } diff --git a/lib/SimpleSAML/Utils/Crypto.php b/lib/SimpleSAML/Utils/Crypto.php index 749d9d2db..a51bbad40 100644 --- a/lib/SimpleSAML/Utils/Crypto.php +++ b/lib/SimpleSAML/Utils/Crypto.php @@ -2,6 +2,8 @@ namespace SimpleSAML\Utils; +use SimpleSAML\Configuration; + /** * A class for cryptography-related functions. * @@ -176,7 +178,7 @@ class Crypto * - 'PEM': Data for the private key, in PEM-format. * - 'password': Password for the private key. * - * @param \SimpleSAML_Configuration $metadata The metadata array the private key should be loaded from. + * @param \SimpleSAML\Configuration $metadata The metadata array the private key should be loaded from. * @param bool $required Whether the private key is required. If this is true, a * missing key will cause an exception. Defaults to false. * @param string $prefix The prefix which should be used when reading from the metadata @@ -192,7 +194,7 @@ class Crypto * @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no> * @author Olav Morken, UNINETT AS <olav.morken@uninett.no> */ - public static function loadPrivateKey(\SimpleSAML_Configuration $metadata, $required = false, $prefix = '', $full_path = false) + public static function loadPrivateKey(Configuration $metadata, $required = false, $prefix = '', $full_path = false) { if (!is_bool($required) || !is_string($prefix) || !is_bool($full_path)) { throw new \InvalidArgumentException('Invalid input parameters.'); @@ -246,14 +248,14 @@ class Crypto * - 'certFingerprint': Array of valid certificate fingerprints. (Deprecated. Only present if this is a * certificate.) * - * @param \SimpleSAML_Configuration $metadata The metadata. + * @param \SimpleSAML\Configuration $metadata The metadata. * @param bool $required Whether the private key is required. If this is TRUE, a missing key * will cause an exception. Default is FALSE. * @param string $prefix The prefix which should be used when reading from the metadata array. * Defaults to ''. * * @return array|NULL Public key or certificate data, or NULL if no public key or certificate was found. - * @throws \InvalidArgumentException If $metadata is not an instance of \SimpleSAML_Configuration, $required is not + * @throws \InvalidArgumentException If $metadata is not an instance of \SimpleSAML\Configuration, $required is not * boolean or $prefix is not a string. * @throws \SimpleSAML_Error_Exception If no private key is found in the metadata, or it was not possible to load * it. @@ -262,7 +264,7 @@ class Crypto * @author Olav Morken, UNINETT AS <olav.morken@uninett.no> * @author Lasse Birnbaum Jensen */ - public static function loadPublicKey(\SimpleSAML_Configuration $metadata, $required = false, $prefix = '') + public static function loadPublicKey(Configuration $metadata, $required = false, $prefix = '') { if (!is_bool($required) || !is_string($prefix)) { throw new \InvalidArgumentException('Invalid input parameters.'); diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php index 7233c9cc1..011fdb5f3 100644 --- a/lib/SimpleSAML/Utils/HTTP.php +++ b/lib/SimpleSAML/Utils/HTTP.php @@ -1,6 +1,7 @@ <?php namespace SimpleSAML\Utils; +use SimpleSAML\Configuration; use SimpleSAML\Module; use SimpleSAML\Logger; @@ -331,7 +332,7 @@ class HTTP // get the white list of domains if ($trustedSites === null) { - $trustedSites = \SimpleSAML_Configuration::getInstance()->getValue('trusted.url.domains', array()); + $trustedSites = Configuration::getInstance()->getValue('trusted.url.domains', array()); } // validates the URL's host is among those allowed @@ -357,7 +358,7 @@ class HTTP $self_host = self::getSelfHostWithNonStandardPort(); - $trustedRegex = \SimpleSAML_Configuration::getInstance()->getValue('trusted.url.regex', false); + $trustedRegex = Configuration::getInstance()->getValue('trusted.url.regex', false); $trusted = false; if ($trustedRegex) { @@ -411,7 +412,7 @@ class HTTP throw new \InvalidArgumentException('Invalid input parameters.'); } - $config = \SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); $proxy = $config->getString('proxy', null); if ($proxy !== null) { @@ -596,7 +597,7 @@ class HTTP */ public static function getBaseURL() { - $globalConfig = \SimpleSAML_Configuration::getInstance(); + $globalConfig = Configuration::getInstance(); $baseURL = $globalConfig->getString('baseurlpath', 'simplesaml/'); if (preg_match('#^https?://.*/?$#D', $baseURL, $matches)) { @@ -669,7 +670,7 @@ class HTTP throw new \InvalidArgumentException('Invalid input parameters.'); } - $config = \SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); $allowed = $config->getBoolean('enable.http_post', false); if ($allowed && preg_match("#^http:#", $destination) && self::isHTTPS()) { @@ -759,7 +760,7 @@ class HTTP */ public static function getSelfURL() { - $cfg = \SimpleSAML_Configuration::getInstance(); + $cfg = Configuration::getInstance(); $baseDir = $cfg->getBaseDir(); $cur_path = realpath($_SERVER['SCRIPT_FILENAME']); // make sure we got a string from realpath() @@ -790,9 +791,9 @@ class HTTP * for this case in the configuration. First, check if that's the case. */ - /** @var \SimpleSAML_Configuration $appcfg */ + /** @var \SimpleSAML\Configuration $appcfg */ $appcfg = $cfg->getConfigItem('application', null); - $appurl = ($appcfg instanceof \SimpleSAML_Configuration) ? $appcfg->getString('baseURL', '') : ''; + $appurl = ($appcfg instanceof Configuration) ? $appcfg->getString('baseURL', '') : ''; if (!empty($appurl)) { $protocol = parse_url($appurl, PHP_URL_SCHEME); $hostname = parse_url($appurl, PHP_URL_HOST); @@ -1205,7 +1206,7 @@ class HTTP throw new \InvalidArgumentException('Invalid input parameters.'); } - $config = \SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); $allowed = $config->getBoolean('enable.http_post', false); if ($allowed && preg_match("#^http:#", $destination) && self::isHTTPS()) { diff --git a/lib/SimpleSAML/Utils/System.php b/lib/SimpleSAML/Utils/System.php index f9d71f029..72aaa48e9 100644 --- a/lib/SimpleSAML/Utils/System.php +++ b/lib/SimpleSAML/Utils/System.php @@ -69,7 +69,7 @@ class System */ public static function getTempDir() { - $globalConfig = \SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $tempDir = rtrim( $globalConfig->getString( @@ -118,7 +118,7 @@ class System public static function resolvePath($path, $base = null) { if ($base === null) { - $config = \SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $base = $config->getBaseDir(); } diff --git a/lib/SimpleSAML/Utils/Time.php b/lib/SimpleSAML/Utils/Time.php index 21c005e50..73b74255c 100644 --- a/lib/SimpleSAML/Utils/Time.php +++ b/lib/SimpleSAML/Utils/Time.php @@ -54,7 +54,7 @@ class Time return; } - $globalConfig = \SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $timezone = $globalConfig->getString('timezone', null); if ($timezone !== null) { diff --git a/lib/SimpleSAML/Utils/XML.php b/lib/SimpleSAML/Utils/XML.php index 3f540d96a..c5ff545b6 100644 --- a/lib/SimpleSAML/Utils/XML.php +++ b/lib/SimpleSAML/Utils/XML.php @@ -45,8 +45,8 @@ class XML } // see if debugging is enabled for XML validation - $debug = \SimpleSAML_Configuration::getInstance()->getArrayize('debug', array('validatexml' => false)); - $enabled = \SimpleSAML_Configuration::getInstance()->getBoolean('debug.validatexml', false); + $debug = \SimpleSAML\Configuration::getInstance()->getArrayize('debug', array('validatexml' => false)); + $enabled = \SimpleSAML\Configuration::getInstance()->getBoolean('debug.validatexml', false); if (!(in_array('validatexml', $debug, true) // implicitly enabled || (array_key_exists('validatexml', $debug) && $debug['validatexml'] === true) // explicitly enabled @@ -98,7 +98,7 @@ class XML } // see if debugging is enabled for SAML messages - $debug = \SimpleSAML_Configuration::getInstance()->getArrayize('debug', array('saml' => false)); + $debug = \SimpleSAML\Configuration::getInstance()->getArrayize('debug', array('saml' => false)); if (!(in_array('saml', $debug, true) // implicitly enabled || (array_key_exists('saml', $debug) && $debug['saml'] === true) // explicitly enabled @@ -429,7 +429,7 @@ class XML } if ($res) { - $config = \SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); /** @var string $schemaPath */ $schemaPath = $config->resolvePath('schemas'); $schemaPath .= './'; diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php index 70b06d717..c1b7ef3c3 100644 --- a/lib/SimpleSAML/XHTML/IdPDisco.php +++ b/lib/SimpleSAML/XHTML/IdPDisco.php @@ -19,7 +19,7 @@ class SimpleSAML_XHTML_IdPDisco /** * An instance of the configuration class. * - * @var SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ protected $config; @@ -118,7 +118,7 @@ class SimpleSAML_XHTML_IdPDisco assert(is_string($instance)); // initialize standard classes - $this->config = SimpleSAML_Configuration::getInstance(); + $this->config = \SimpleSAML\Configuration::getInstance(); $this->metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $this->session = SimpleSAML_Session::getSessionFromRequest(); $this->instance = $instance; diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index d23c95f43..beadfa6ca 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -37,7 +37,7 @@ class SimpleSAML_XHTML_Template /** * The configuration to use in this template. * - * @var SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ private $configuration; @@ -93,11 +93,11 @@ class SimpleSAML_XHTML_Template /** * Constructor * - * @param SimpleSAML_Configuration $configuration Configuration object + * @param \SimpleSAML\Configuration $configuration Configuration object * @param string $template Which template file to load * @param string|null $defaultDictionary The default dictionary where tags will come from. */ - public function __construct(\SimpleSAML_Configuration $configuration, $template, $defaultDictionary = null) + public function __construct(\SimpleSAML\Configuration $configuration, $template, $defaultDictionary = null) { $this->configuration = $configuration; $this->template = $template; diff --git a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php index 61a8f32ba..4e446a24c 100644 --- a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php +++ b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php @@ -300,13 +300,13 @@ class AuthnResponse /** * Build a authentication response. * - * @param \SimpleSAML_Configuration $idp Metadata for the IdP the response is sent from. - * @param \SimpleSAML_Configuration $sp Metadata for the SP the response is sent to. + * @param \SimpleSAML\Configuration $idp Metadata for the IdP the response is sent from. + * @param \SimpleSAML\Configuration $sp Metadata for the SP the response is sent to. * @param string $shire The endpoint on the SP the response is sent to. * @param array|null $attributes The attributes which should be included in the response. * @return string The response. */ - public function generate(\SimpleSAML_Configuration $idp, \SimpleSAML_Configuration $sp, $shire, $attributes) + public function generate(\SimpleSAML\Configuration $idp, \SimpleSAML\Configuration $sp, $shire, $attributes) { assert(is_string($shire)); assert($attributes === null || is_array($attributes)); diff --git a/modules/adfs/lib/IdP/ADFS.php b/modules/adfs/lib/IdP/ADFS.php index c17b4d8a7..f6d511044 100644 --- a/modules/adfs/lib/IdP/ADFS.php +++ b/modules/adfs/lib/IdP/ADFS.php @@ -153,7 +153,7 @@ MSG; { $spMetadata = $state["SPMetadata"]; $spEntityId = $spMetadata['entityid']; - $spMetadata = SimpleSAML_Configuration::loadFromArray($spMetadata, '$metadata['.var_export($spEntityId, true).']'); + $spMetadata = \SimpleSAML\Configuration::loadFromArray($spMetadata, '$metadata['.var_export($spEntityId, true).']'); $attributes = $state['Attributes']; diff --git a/modules/adfs/www/idp/metadata.php b/modules/adfs/www/idp/metadata.php index aaec9361c..f12fd78bb 100644 --- a/modules/adfs/www/idp/metadata.php +++ b/modules/adfs/www/idp/metadata.php @@ -1,7 +1,7 @@ <?php // load configuration and metadata -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); if (!$config->getBoolean('enable.adfs-idp', false)) { diff --git a/modules/authX509/lib/Auth/Source/X509userCert.php b/modules/authX509/lib/Auth/Source/X509userCert.php index 36f93a48f..a03b96c1d 100644 --- a/modules/authX509/lib/Auth/Source/X509userCert.php +++ b/modules/authX509/lib/Auth/Source/X509userCert.php @@ -68,7 +68,7 @@ class sspmod_authX509_Auth_Source_X509userCert extends SimpleSAML_Auth_Source */ public function authFailed(&$state) { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($config, 'authX509:X509error.php'); $t->data['errorcode'] = $state['authX509.error']; diff --git a/modules/authX509/www/expirywarning.php b/modules/authX509/www/expirywarning.php index be6e4f664..7b1671317 100644 --- a/modules/authX509/www/expirywarning.php +++ b/modules/authX509/www/expirywarning.php @@ -20,7 +20,7 @@ if (array_key_exists('proceed', $_REQUEST)) { SimpleSAML_Auth_ProcessingChain::resumeProcessing($state); } -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'authX509:X509warning.php'); $t->data['target'] = SimpleSAML\Module::getModuleURL('authX509/expirywarning.php'); diff --git a/modules/authYubiKey/www/yubikeylogin.php b/modules/authYubiKey/www/yubikeylogin.php index 1d0c7597a..5fa9ee701 100644 --- a/modules/authYubiKey/www/yubikeylogin.php +++ b/modules/authYubiKey/www/yubikeylogin.php @@ -27,7 +27,7 @@ if (!empty($otp)) { $errorCode = NULL; } -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'authYubiKey:yubikeylogin.php'); $t->data['stateparams'] = array('AuthState' => $authStateId); $t->data['errorcode'] = $errorCode; diff --git a/modules/authfacebook/lib/Auth/Source/Facebook.php b/modules/authfacebook/lib/Auth/Source/Facebook.php index 865e152c3..66f2a5f6e 100644 --- a/modules/authfacebook/lib/Auth/Source/Facebook.php +++ b/modules/authfacebook/lib/Auth/Source/Facebook.php @@ -67,7 +67,7 @@ class sspmod_authfacebook_Auth_Source_Facebook extends SimpleSAML_Auth_Source { // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $cfgParse = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']'); + $cfgParse = \SimpleSAML\Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']'); $this->api_key = $cfgParse->getString('api_key'); $this->secret = $cfgParse->getString('secret'); diff --git a/modules/authorize/www/authorize_403.php b/modules/authorize/www/authorize_403.php index f3f99b25f..fec588740 100644 --- a/modules/authorize/www/authorize_403.php +++ b/modules/authorize/www/authorize_403.php @@ -10,7 +10,7 @@ if (!array_key_exists('StateId', $_REQUEST)) { } $state = SimpleSAML_Auth_State::loadState($_REQUEST['StateId'], 'authorize:Authorize'); -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'authorize:authorize_403.php'); if (isset($state['Source']['auth'])) { $t->data['LogoutURL'] = SimpleSAML\Module::getModuleURL('core/authenticate.php', array('as' => $state['Source']['auth']))."&logout"; diff --git a/modules/authtwitter/lib/Auth/Source/Twitter.php b/modules/authtwitter/lib/Auth/Source/Twitter.php index 2b5d68d93..18a012371 100644 --- a/modules/authtwitter/lib/Auth/Source/Twitter.php +++ b/modules/authtwitter/lib/Auth/Source/Twitter.php @@ -54,7 +54,7 @@ class sspmod_authtwitter_Auth_Source_Twitter extends SimpleSAML_Auth_Source // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $configObject = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, true) . ']'); + $configObject = \SimpleSAML\Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, true) . ']'); $this->key = $configObject->getString('key'); $this->secret = $configObject->getString('secret'); diff --git a/modules/cas/lib/Auth/Source/CAS.php b/modules/cas/lib/Auth/Source/CAS.php index db045d3e6..78fc07403 100644 --- a/modules/cas/lib/Auth/Source/CAS.php +++ b/modules/cas/lib/Auth/Source/CAS.php @@ -187,7 +187,7 @@ class sspmod_cas_Auth_Source_CAS extends SimpleSAML_Auth_Source list($username, $casattributes) = $this->casValidation($ticket, $service); $ldapattributes = array(); - $config = SimpleSAML_Configuration::loadFromArray($this->_ldapConfig, + $config = \SimpleSAML\Configuration::loadFromArray($this->_ldapConfig, 'Authentication source ' . var_export($this->authId, true)); if ($this->_ldapConfig['servers']) { $ldap = new SimpleSAML_Auth_LDAP( diff --git a/modules/casserver/www/login.php b/modules/casserver/www/login.php index fd55f05eb..7b1d967fc 100644 --- a/modules/casserver/www/login.php +++ b/modules/casserver/www/login.php @@ -17,8 +17,8 @@ $service = $_GET['service']; $forceAuthn =isset($_GET['renew']) && $_GET['renew']; $isPassive = isset($_GET['gateway']) && $_GET['gateway']; -$config = SimpleSAML_Configuration::getInstance(); -$casconfig = SimpleSAML_Configuration::getConfig('module_casserver.php'); +$config = \SimpleSAML\Configuration::getInstance(); +$casconfig = \SimpleSAML\Configuration::getConfig('module_casserver.php'); $legal_service_urls = $casconfig->getValue('legal_service_urls'); if (!checkServiceURL($service, $legal_service_urls)) @@ -52,4 +52,4 @@ storeTicket($ticket, $path, array('service' => $service, \SimpleSAML\Utils\HTTP::addURLParameters($service, array('ticket' => $ticket) ) -); \ No newline at end of file +); diff --git a/modules/casserver/www/proxy.php b/modules/casserver/www/proxy.php index 6fc14e4a3..4ae881134 100644 --- a/modules/casserver/www/proxy.php +++ b/modules/casserver/www/proxy.php @@ -15,7 +15,7 @@ if (array_key_exists('targetService', $_GET)) { throw new Exception('Required URL query parameter [targetService] not provided. (CAS Server)'); } -$casconfig = SimpleSAML_Configuration::getConfig('module_casserver.php'); +$casconfig = \SimpleSAML\Configuration::getConfig('module_casserver.php'); $legal_service_urls = $casconfig->getValue('legal_service_urls'); @@ -50,4 +50,4 @@ print <<<eox </cas:proxyFailure> </cas:serviceResponse> eox; -} \ No newline at end of file +} diff --git a/modules/casserver/www/serviceValidate.php b/modules/casserver/www/serviceValidate.php index fd9ebc65a..9fd4fdf62 100644 --- a/modules/casserver/www/serviceValidate.php +++ b/modules/casserver/www/serviceValidate.php @@ -23,7 +23,7 @@ if (array_key_exists('service', $_GET)) { try { // Load SimpleSAMLphp, configuration and metadata - $casconfig = SimpleSAML_Configuration::getConfig('module_casserver.php'); + $casconfig = \SimpleSAML\Configuration::getConfig('module_casserver.php'); $path = $casconfig->resolvePath($casconfig->getValue('ticketcache', 'ticketcache')); $ticketcontent = retrieveTicket($ticket, $path); diff --git a/modules/casserver/www/validate.php b/modules/casserver/www/validate.php index b57c74469..29e29a05f 100644 --- a/modules/casserver/www/validate.php +++ b/modules/casserver/www/validate.php @@ -1,3 +1,4 @@ <?php + $function = 'validate'; include("serviceValidate.php"); diff --git a/modules/cdc/lib/Server.php b/modules/cdc/lib/Server.php index 3727c347d..d14b5fc10 100644 --- a/modules/cdc/lib/Server.php +++ b/modules/cdc/lib/Server.php @@ -50,7 +50,7 @@ class sspmod_cdc_Server { assert(is_string($domain)); - $cdcConfig = SimpleSAML_Configuration::getConfig('module_cdc.php'); + $cdcConfig = \SimpleSAML\Configuration::getConfig('module_cdc.php'); $config = $cdcConfig->getConfigItem($domain, null); if ($config === null) { diff --git a/modules/consent/lib/Consent/Store/Cookie.php b/modules/consent/lib/Consent/Store/Cookie.php index 4d5d1f0d3..fc61b309b 100644 --- a/modules/consent/lib/Consent/Store/Cookie.php +++ b/modules/consent/lib/Consent/Store/Cookie.php @@ -273,7 +273,7 @@ class sspmod_consent_Consent_Store_Cookie extends sspmod_consent_Store assert(is_string($name)); assert(is_string($value) || $value === null); - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $params = array( 'lifetime' => (90*24*60*60), 'path' => ($globalConfig->getBasePath()), diff --git a/modules/consent/www/getconsent.php b/modules/consent/www/getconsent.php index 34572b231..1e936d435 100644 --- a/modules/consent/www/getconsent.php +++ b/modules/consent/www/getconsent.php @@ -19,7 +19,7 @@ */ session_cache_limiter('nocache'); -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); SimpleSAML\Logger::info('Consent - getconsent: Accessing consent interface'); diff --git a/modules/consent/www/logout_completed.php b/modules/consent/www/logout_completed.php index a543c3057..e0d2a077a 100644 --- a/modules/consent/www/logout_completed.php +++ b/modules/consent/www/logout_completed.php @@ -5,6 +5,6 @@ * @package SimpleSAMLphp */ -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'consent:logout_completed.php'); $t->show(); diff --git a/modules/consent/www/noconsent.php b/modules/consent/www/noconsent.php index 7fcd57b12..9a73b0b71 100644 --- a/modules/consent/www/noconsent.php +++ b/modules/consent/www/noconsent.php @@ -37,7 +37,7 @@ if (isset($state['Destination']['entityid'])) { } SimpleSAML_Stats::log('consent:reject', $statsInfo); -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'consent:noconsent.php'); $t->data['dstMetadata'] = $state['Destination']; diff --git a/modules/consentAdmin/www/consentAdmin.php b/modules/consentAdmin/www/consentAdmin.php index c1e35b482..eee9cf44b 100644 --- a/modules/consentAdmin/www/consentAdmin.php +++ b/modules/consentAdmin/www/consentAdmin.php @@ -79,8 +79,8 @@ function driveProcessingChain( } // Get config object -$config = SimpleSAML_Configuration::getInstance(); -$cA_config = SimpleSAML_Configuration::getConfig('module_consentAdmin.php'); +$config = \SimpleSAML\Configuration::getInstance(); +$cA_config = \SimpleSAML\Configuration::getConfig('module_consentAdmin.php'); $authority = $cA_config->getValue('authority'); $as = new \SimpleSAML\Auth\Simple($authority); diff --git a/modules/core/hooks/hook_sanitycheck.php b/modules/core/hooks/hook_sanitycheck.php index 237a295ca..d3683a369 100644 --- a/modules/core/hooks/hook_sanitycheck.php +++ b/modules/core/hooks/hook_sanitycheck.php @@ -9,7 +9,7 @@ function core_hook_sanitycheck(&$hookinfo) { assert(array_key_exists('errors', $hookinfo)); assert(array_key_exists('info', $hookinfo)); - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); if($config->getString('auth.adminpassword', '123') === '123') { $hookinfo['errors'][] = '[core] Password in config.php is not set properly'; diff --git a/modules/core/lib/ACL.php b/modules/core/lib/ACL.php index 175c6c262..6afdd7b78 100644 --- a/modules/core/lib/ACL.php +++ b/modules/core/lib/ACL.php @@ -55,7 +55,7 @@ class sspmod_core_ACL { private static function getById($id) { assert(is_string($id)); - $config = SimpleSAML_Configuration::getOptionalConfig('acl.php'); + $config = \SimpleSAML\Configuration::getOptionalConfig('acl.php'); if (!$config->hasValue($id)) { throw new SimpleSAML_Error_Exception('No ACL with id ' . var_export($id, TRUE) . ' in config/acl.php.'); } diff --git a/modules/core/lib/Auth/Process/AttributeMap.php b/modules/core/lib/Auth/Process/AttributeMap.php index f64efb0ad..ccd7addf1 100644 --- a/modules/core/lib/Auth/Process/AttributeMap.php +++ b/modules/core/lib/Auth/Process/AttributeMap.php @@ -75,7 +75,7 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi */ private function loadMapFile($fileName) { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $m = explode(':', $fileName); if (count($m) === 2) { // we are asked for a file in a module diff --git a/modules/core/lib/Auth/Process/ExtendIdPSession.php b/modules/core/lib/Auth/Process/ExtendIdPSession.php index faca137a8..c58972743 100644 --- a/modules/core/lib/Auth/Process/ExtendIdPSession.php +++ b/modules/core/lib/Auth/Process/ExtendIdPSession.php @@ -15,7 +15,7 @@ class sspmod_core_Auth_Process_ExtendIdPSession extends SimpleSAML_Auth_Processi $now = time(); $delta = $state['Expire'] - $now; - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); $sessionDuration = $globalConfig->getInteger('session.duration', 8*60*60); // Extend only if half of session duration already passed diff --git a/modules/core/lib/Auth/Process/ScopeAttribute.php b/modules/core/lib/Auth/Process/ScopeAttribute.php index a44ff14de..251ef0917 100644 --- a/modules/core/lib/Auth/Process/ScopeAttribute.php +++ b/modules/core/lib/Auth/Process/ScopeAttribute.php @@ -49,7 +49,7 @@ class sspmod_core_Auth_Process_ScopeAttribute extends SimpleSAML_Auth_Processing parent::__construct($config, $reserved); assert(is_array($config)); - $config = SimpleSAML_Configuration::loadFromArray($config, 'ScopeAttribute'); + $config = \SimpleSAML\Configuration::loadFromArray($config, 'ScopeAttribute'); $this->scopeAttribute = $config->getString('scopeAttribute'); $this->sourceAttribute = $config->getString('sourceAttribute'); diff --git a/modules/core/lib/Auth/Process/ScopeFromAttribute.php b/modules/core/lib/Auth/Process/ScopeFromAttribute.php index 818a24f76..098856f99 100644 --- a/modules/core/lib/Auth/Process/ScopeFromAttribute.php +++ b/modules/core/lib/Auth/Process/ScopeFromAttribute.php @@ -40,7 +40,7 @@ class sspmod_core_Auth_Process_ScopeFromAttribute extends SimpleSAML_Auth_Proces parent::__construct($config, $reserved); assert(is_array($config)); - $config = SimpleSAML_Configuration::loadFromArray($config, 'ScopeFromAttribute'); + $config = \SimpleSAML\Configuration::loadFromArray($config, 'ScopeFromAttribute'); $this->targetAttribute = $config->getString('targetAttribute'); $this->sourceAttribute = $config->getString('sourceAttribute'); } // end constructor diff --git a/modules/core/lib/Auth/Source/AdminPassword.php b/modules/core/lib/Auth/Source/AdminPassword.php index 3ba1a8210..f955f8078 100644 --- a/modules/core/lib/Auth/Source/AdminPassword.php +++ b/modules/core/lib/Auth/Source/AdminPassword.php @@ -43,7 +43,7 @@ class sspmod_core_Auth_Source_AdminPassword extends sspmod_core_Auth_UserPassBas assert(is_string($username)); assert(is_string($password)); - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $adminPassword = $config->getString('auth.adminpassword', '123'); if ($adminPassword === '123') { // We require that the user changes the password diff --git a/modules/core/lib/Auth/UserPassBase.php b/modules/core/lib/Auth/UserPassBase.php index 474d0a03b..39b675232 100644 --- a/modules/core/lib/Auth/UserPassBase.php +++ b/modules/core/lib/Auth/UserPassBase.php @@ -103,7 +103,7 @@ abstract class sspmod_core_Auth_UserPassBase extends SimpleSAML_Auth_Source { } // get the "remember me" config options - $sspcnf = SimpleSAML_Configuration::getInstance(); + $sspcnf = \SimpleSAML\Configuration::getInstance(); $this->rememberMeEnabled = $sspcnf->getBoolean('session.rememberme.enable', FALSE); $this->rememberMeChecked = $sspcnf->getBoolean('session.rememberme.checked', FALSE); } diff --git a/modules/core/lib/Stats/Output/File.php b/modules/core/lib/Stats/Output/File.php index 0642bcda2..ce690e251 100644 --- a/modules/core/lib/Stats/Output/File.php +++ b/modules/core/lib/Stats/Output/File.php @@ -30,9 +30,9 @@ class sspmod_core_Stats_Output_File extends SimpleSAML_Stats_Output { /** * Initialize the output. * - * @param SimpleSAML_Configuration $config The configuration for this output. + * @param \SimpleSAML\Configuration $config The configuration for this output. */ - public function __construct(SimpleSAML_Configuration $config) { + public function __construct(\SimpleSAML\Configuration $config) { $this->logDir = $config->getPathValue('directory'); if ($this->logDir === NULL) { diff --git a/modules/core/lib/Stats/Output/Log.php b/modules/core/lib/Stats/Output/Log.php index 70e914e4b..ec26f7b4c 100644 --- a/modules/core/lib/Stats/Output/Log.php +++ b/modules/core/lib/Stats/Output/Log.php @@ -17,10 +17,9 @@ class sspmod_core_Stats_Output_Log extends SimpleSAML_Stats_Output { /** * Initialize the output. * - * @param SimpleSAML_Configuration $config The configuration for this output. + * @param \SimpleSAML\Configuration $config The configuration for this output. */ - public function __construct(SimpleSAML_Configuration $config) { - + public function __construct(\SimpleSAML\Configuration $config) { $logLevel = $config->getString('level', 'notice'); $this->logger = array('SimpleSAML\Logger', $logLevel); if (!is_callable($this->logger)) { diff --git a/modules/core/lib/Storage/SQLPermanentStorage.php b/modules/core/lib/Storage/SQLPermanentStorage.php index 104de7e33..0c22f75d8 100644 --- a/modules/core/lib/Storage/SQLPermanentStorage.php +++ b/modules/core/lib/Storage/SQLPermanentStorage.php @@ -16,7 +16,7 @@ class sspmod_core_Storage_SQLPermanentStorage public function __construct($name, $config = null) { if (is_null($config)) { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); } $datadir = $config->getPathValue('datadir', 'data/'); diff --git a/modules/core/www/authenticate.php b/modules/core/www/authenticate.php index bfb717c80..ed56c6a06 100644 --- a/modules/core/www/authenticate.php +++ b/modules/core/www/authenticate.php @@ -1,6 +1,6 @@ <?php -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); if (!array_key_exists('as', $_REQUEST)) { $t = new SimpleSAML_XHTML_Template($config, 'core:authsource_list.tpl.php'); diff --git a/modules/core/www/cardinality_error.php b/modules/core/www/cardinality_error.php index 4b36495fb..82a1a4efe 100644 --- a/modules/core/www/cardinality_error.php +++ b/modules/core/www/cardinality_error.php @@ -15,7 +15,7 @@ $session = \SimpleSAML_Session::getSessionFromRequest(); \SimpleSAML\Logger::stats('core:cardinality:error '.$state['Destination']['entityid'].' '.$state['saml:sp:IdP']. ' '.implode(',', array_keys($state['core:cardinality:errorAttributes']))); -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML_XHTML_Template($globalConfig, 'core:cardinality_error.tpl.php'); $t->data['cardinalityErrorAttributes'] = $state['core:cardinality:errorAttributes']; if (isset($state['Source']['auth'])) { diff --git a/modules/core/www/cleardiscochoices.php b/modules/core/www/cleardiscochoices.php index 3628a4531..88a83be82 100644 --- a/modules/core/www/cleardiscochoices.php +++ b/modules/core/www/cleardiscochoices.php @@ -7,7 +7,7 @@ require_once('_include.php'); */ // The base path for cookies. This should be the installation directory for SimpleSAMLphp. -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $cookiePath = $config->getBasePath(); // We delete all cookies which starts with 'idpdisco_' diff --git a/modules/core/www/frontpage_auth.php b/modules/core/www/frontpage_auth.php index 59e0ee8a5..20c95f393 100644 --- a/modules/core/www/frontpage_auth.php +++ b/modules/core/www/frontpage_auth.php @@ -1,8 +1,7 @@ <?php - // Load SimpleSAMLphp, configuration -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); // Check if valid local session exists @@ -12,17 +11,12 @@ if ($config->getBoolean('admin.protectindexpage', false)) { $loginurl = SimpleSAML\Utils\Auth::getAdminLoginURL(); $isadmin = SimpleSAML\Utils\Auth::isAdmin(); - - - - $links = array(); $links_welcome = array(); $links_config = array(); $links_auth = array(); $links_federation = array(); - $links_auth[] = array( 'href' => 'authenticate.php', 'text' => '{core:frontpage:authtest}', @@ -37,8 +31,6 @@ $allLinks = array( ); SimpleSAML\Module::callHooks('frontpage', $allLinks); - - $t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_auth.tpl.php'); $t->data['pageid'] = 'frontpage_auth'; $t->data['isadmin'] = $isadmin; @@ -50,8 +42,6 @@ $t->data['links_config'] = $links_config; $t->data['links_auth'] = $links_auth; $t->data['links_federation'] = $links_federation; - - $t->show(); diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php index 805b23bb4..72b8c5617 100644 --- a/modules/core/www/frontpage_config.php +++ b/modules/core/www/frontpage_config.php @@ -1,7 +1,7 @@ <?php -// Load SimpleSAMLphp, configuration -$config = SimpleSAML_Configuration::getInstance(); +// Load SimpleSAMLphp configuration +$config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); // Check if valid local session exists. diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php index 80f8aa7ed..fb9ba7d6e 100644 --- a/modules/core/www/frontpage_federation.php +++ b/modules/core/www/frontpage_federation.php @@ -1,9 +1,7 @@ <?php - - // Load SimpleSAMLphp, configuration -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); // Check if valid local session exists. @@ -13,21 +11,12 @@ if ($config->getBoolean('admin.protectindexpage', false)) { $loginurl = SimpleSAML\Utils\Auth::getAdminLoginURL(); $isadmin = SimpleSAML\Utils\Auth::isAdmin(); - - - - - - $links = array(); $links_welcome = array(); $links_config = array(); $links_auth = array(); $links_federation = array(); - - - if($config->getBoolean('idpdisco.enableremember', FALSE)) { $links_federation[] = array( 'href' => 'cleardiscochoices.php', @@ -41,9 +30,6 @@ $links_federation[] = array( 'text' => '{core:frontpage:link_xmlconvert}', ); - - - $allLinks = array( 'links' => &$links, 'welcome' => &$links_welcome, @@ -58,13 +44,6 @@ $metadataHosted = array(); SimpleSAML\Module::callHooks('metadata_hosted', $metadataHosted); - - - - - - - $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $metaentries = array('hosted' => $metadataHosted, 'remote' => array() ); diff --git a/modules/core/www/frontpage_welcome.php b/modules/core/www/frontpage_welcome.php index abeeecea1..ec6171273 100644 --- a/modules/core/www/frontpage_welcome.php +++ b/modules/core/www/frontpage_welcome.php @@ -1,8 +1,8 @@ <?php -// Load SimpleSAMLphp, configuration -$config = SimpleSAML_Configuration::getInstance(); +// Load SimpleSAMLphp configuration +$config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); // Check if valid local session exists. @@ -12,18 +12,12 @@ if ($config->getBoolean('admin.protectindexpage', false)) { $loginurl = SimpleSAML\Utils\Auth::getAdminLoginURL(); $isadmin = SimpleSAML\Utils\Auth::isAdmin(); - - - - $links = array(); $links_welcome = array(); $links_config = array(); $links_auth = array(); $links_federation = array(); - - $allLinks = array( 'links' => &$links, 'welcome' => &$links_welcome, @@ -39,14 +33,6 @@ $links_welcome[] = array( SimpleSAML\Module::callHooks('frontpage', $allLinks); - - - - - - - - $t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_welcome.tpl.php'); $t->data['pageid'] = 'frontpage_welcome'; $t->data['isadmin'] = $isadmin; diff --git a/modules/core/www/idp/logout-iframe.php b/modules/core/www/idp/logout-iframe.php index caf00f11d..71b908760 100644 --- a/modules/core/www/idp/logout-iframe.php +++ b/modules/core/www/idp/logout-iframe.php @@ -113,7 +113,7 @@ foreach ($state['core:Logout-IFrame:Associations'] as $association) { } $id = SimpleSAML_Auth_State::saveState($state, 'core:Logout-IFrame'); -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $template_id = 'core:logout-iframe.php'; if ($type === 'nojs') { diff --git a/modules/core/www/loginuserpass.php b/modules/core/www/loginuserpass.php index 78ba32a0a..2469c2220 100644 --- a/modules/core/www/loginuserpass.php +++ b/modules/core/www/loginuserpass.php @@ -72,7 +72,7 @@ if (!empty($_REQUEST['username']) || !empty($password)) { } } -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'core:loginuserpass.php'); $t->data['stateparams'] = array('AuthState' => $authStateId); if (array_key_exists('forcedUsername', $state)) { diff --git a/modules/core/www/loginuserpassorg.php b/modules/core/www/loginuserpassorg.php index 81deccf83..07a89859c 100644 --- a/modules/core/www/loginuserpassorg.php +++ b/modules/core/www/loginuserpassorg.php @@ -70,7 +70,7 @@ if ($organizations === NULL || !empty($organization)) { } } -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'core:loginuserpass.php'); $t->data['stateparams'] = array('AuthState' => $authStateId); $t->data['username'] = $username; diff --git a/modules/core/www/no_cookie.php b/modules/core/www/no_cookie.php index 46e67a579..76ddd662d 100644 --- a/modules/core/www/no_cookie.php +++ b/modules/core/www/no_cookie.php @@ -7,7 +7,7 @@ if (isset($_REQUEST['retryURL'])) { $retryURL = null; } -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'core:no_cookie.tpl.php'); $t->data['retryURL'] = $retryURL; $t->show(); diff --git a/modules/core/www/postredirect.php b/modules/core/www/postredirect.php index 2f3cb131c..446a54e2e 100644 --- a/modules/core/www/postredirect.php +++ b/modules/core/www/postredirect.php @@ -44,7 +44,7 @@ assert(is_array($postData)); assert(array_key_exists('url', $postData)); assert(array_key_exists('post', $postData)); -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $template = new SimpleSAML_XHTML_Template($config, 'post.php'); $template->data['destination'] = $postData['url']; $template->data['post'] = $postData['post']; diff --git a/modules/core/www/short_sso_interval.php b/modules/core/www/short_sso_interval.php index 0690b1b4f..ec9673327 100644 --- a/modules/core/www/short_sso_interval.php +++ b/modules/core/www/short_sso_interval.php @@ -18,7 +18,7 @@ if (array_key_exists('continue', $_REQUEST)) { SimpleSAML_Auth_ProcessingChain::resumeProcessing($state); } -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'core:short_sso_interval.php'); $t->data['target'] = SimpleSAML\Module::getModuleURL('core/short_sso_interval.php'); $t->data['params'] = array('StateId' => $id); diff --git a/modules/core/www/show_metadata.php b/modules/core/www/show_metadata.php index fd03d9f56..07744c3e1 100644 --- a/modules/core/www/show_metadata.php +++ b/modules/core/www/show_metadata.php @@ -1,7 +1,7 @@ <?php // load configuration -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); SimpleSAML\Utils\Auth::requireAdmin(); diff --git a/modules/cron/hooks/hook_cron.php b/modules/cron/hooks/hook_cron.php index ba175b4eb..6d2cd290c 100644 --- a/modules/cron/hooks/hook_cron.php +++ b/modules/cron/hooks/hook_cron.php @@ -9,7 +9,7 @@ function cron_hook_cron(&$croninfo) { assert(array_key_exists('summary', $croninfo)); assert(array_key_exists('tag', $croninfo)); - $cronconfig = SimpleSAML_Configuration::getConfig('module_cron.php'); + $cronconfig = \SimpleSAML\Configuration::getConfig('module_cron.php'); if ($cronconfig->getValue('debug_message', TRUE)) { diff --git a/modules/cron/lib/Cron.php b/modules/cron/lib/Cron.php index bba782afa..0df16e375 100644 --- a/modules/cron/lib/Cron.php +++ b/modules/cron/lib/Cron.php @@ -9,18 +9,18 @@ class Cron { /** * The configuration for the Cron module - * @var \SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ private $cronconfig; /* - * @param \SimpleSAML_Configuration $cronconfig The cron configuration to use. If not specified defaults + * @param \SimpleSAML\Configuration $cronconfig The cron configuration to use. If not specified defaults * to `config/module_cron.php` */ - public function __construct(\SimpleSAML_Configuration $cronconfig = null) + public function __construct(\SimpleSAML\Configuration $cronconfig = null) { if ($cronconfig == null) { - $cronconfig = \SimpleSAML_Configuration::getConfig('module_cron.php'); + $cronconfig = \SimpleSAML\Configuration::getConfig('module_cron.php'); } $this->cronconfig = $cronconfig; } diff --git a/modules/cron/www/cron.php b/modules/cron/www/cron.php index 4f22fc5df..d8463d745 100644 --- a/modules/cron/www/cron.php +++ b/modules/cron/www/cron.php @@ -1,7 +1,7 @@ <?php -$config = SimpleSAML_Configuration::getInstance(); -$cronconfig = SimpleSAML_Configuration::getConfig('module_cron.php'); +$config = \SimpleSAML\Configuration::getInstance(); +$cronconfig = \SimpleSAML\Configuration::getConfig('module_cron.php'); if (!is_null($cronconfig->getValue('key'))) { if ($_REQUEST['key'] !== $cronconfig->getValue('key')) { diff --git a/modules/cron/www/croninfo.php b/modules/cron/www/croninfo.php index 93b7acb5b..8d207e79e 100644 --- a/modules/cron/www/croninfo.php +++ b/modules/cron/www/croninfo.php @@ -8,12 +8,12 @@ require_once('_include.php'); // Load SimpleSAMLphp, configuration and metadata -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); SimpleSAML\Utils\Auth::requireAdmin(); -$cronconfig = SimpleSAML_Configuration::getConfig('module_cron.php'); +$cronconfig = \SimpleSAML\Configuration::getConfig('module_cron.php'); $key = $cronconfig->getValue('key', ''); $tags = $cronconfig->getValue('allowed_tags'); diff --git a/modules/discopower/lib/PowerIdPDisco.php b/modules/discopower/lib/PowerIdPDisco.php index d7f0e7f64..be41e6f34 100644 --- a/modules/discopower/lib/PowerIdPDisco.php +++ b/modules/discopower/lib/PowerIdPDisco.php @@ -17,7 +17,7 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco /** * The configuration for this instance. * - * @var SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ private $discoconfig; @@ -51,7 +51,7 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco { parent::__construct($metadataSets, $instance); - $this->discoconfig = SimpleSAML_Configuration::getConfig('module_discopower.php'); + $this->discoconfig = \SimpleSAML\Configuration::getConfig('module_discopower.php'); $this->cdcDomain = $this->discoconfig->getString('cdc.domain', null); if ($this->cdcDomain !== null && $this->cdcDomain[0] !== '.') { diff --git a/modules/expirycheck/www/about2expire.php b/modules/expirycheck/www/about2expire.php index 089d82985..f85a09d9a 100644 --- a/modules/expirycheck/www/about2expire.php +++ b/modules/expirycheck/www/about2expire.php @@ -19,7 +19,7 @@ if (array_key_exists('yes', $_REQUEST)) { SimpleSAML_Auth_ProcessingChain::resumeProcessing($state); } -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'expirycheck:about2expire.php'); $t->data['yesTarget'] = SimpleSAML\Module::getModuleURL('expirycheck/about2expire.php'); diff --git a/modules/expirycheck/www/expired.php b/modules/expirycheck/www/expired.php index 87eef83da..225406910 100644 --- a/modules/expirycheck/www/expired.php +++ b/modules/expirycheck/www/expired.php @@ -13,7 +13,7 @@ if (!array_key_exists('StateId', $_REQUEST)) { } $state = SimpleSAML_Auth_State::loadState($_REQUEST['StateId'], 'expirywarning:expired'); -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'expirycheck:expired.php'); $t->data['expireOnDate'] = $state['expireOnDate']; diff --git a/modules/ldap/lib/Auth/Process/BaseFilter.php b/modules/ldap/lib/Auth/Process/BaseFilter.php index d7116a2d8..bfec4bb38 100644 --- a/modules/ldap/lib/Auth/Process/BaseFilter.php +++ b/modules/ldap/lib/Auth/Process/BaseFilter.php @@ -36,10 +36,10 @@ abstract class sspmod_ldap_Auth_Process_BaseFilter extends SimpleSAML_Auth_Proce /** * The construct method will change the filter config into - * a SimpleSAML_Configuration object and store it here for + * a \SimpleSAML\Configuration object and store it here for * later use, if needed. * - * @var SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ protected $config; @@ -116,7 +116,7 @@ abstract class sspmod_ldap_Auth_Process_BaseFilter extends SimpleSAML_Auth_Proce ); // Get the authsources file, which should contain the config - $authsource = SimpleSAML_Configuration::getConfig('authsources.php'); + $authsource = \SimpleSAML\Configuration::getConfig('authsources.php'); // Verify that the authsource config exists if (!$authsource->hasValue($config['authsource'])) { @@ -203,7 +203,7 @@ abstract class sspmod_ldap_Auth_Process_BaseFilter extends SimpleSAML_Auth_Proce // Convert the config array to a config class, // that way we can verify type and define defaults. // Store in the instance in-case needed later, by a child class. - $this->config = SimpleSAML_Configuration::loadFromArray($config, 'ldap:AuthProcess'); + $this->config = \SimpleSAML\Configuration::loadFromArray($config, 'ldap:AuthProcess'); // Set all the filter values, setting defaults if needed $this->base_dn = $this->config->getArrayizeString('ldap.basedn', ''); diff --git a/modules/ldap/lib/Auth/Source/LDAPMulti.php b/modules/ldap/lib/Auth/Source/LDAPMulti.php index c11a43e46..c900f8bba 100644 --- a/modules/ldap/lib/Auth/Source/LDAPMulti.php +++ b/modules/ldap/lib/Auth/Source/LDAPMulti.php @@ -43,7 +43,7 @@ class sspmod_ldap_Auth_Source_LDAPMulti extends sspmod_core_Auth_UserPassOrgBase // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $cfgHelper = SimpleSAML_Configuration::loadFromArray($config, + $cfgHelper = \SimpleSAML\Configuration::loadFromArray($config, 'Authentication source ' . var_export($this->authId, true)); diff --git a/modules/ldap/lib/ConfigHelper.php b/modules/ldap/lib/ConfigHelper.php index c02adf8b0..6e0f60902 100644 --- a/modules/ldap/lib/ConfigHelper.php +++ b/modules/ldap/lib/ConfigHelper.php @@ -131,7 +131,7 @@ class sspmod_ldap_ConfigHelper $this->location = $location; // Parse configuration - $config = SimpleSAML_Configuration::loadFromArray($config, $location); + $config = \SimpleSAML\Configuration::loadFromArray($config, $location); $this->hostname = $config->getString('hostname'); $this->enableTLS = $config->getBoolean('enable_tls', false); diff --git a/modules/memcacheMonitor/www/memcachestat.php b/modules/memcacheMonitor/www/memcachestat.php index 1410b8b9e..5e9caa8f4 100644 --- a/modules/memcacheMonitor/www/memcachestat.php +++ b/modules/memcacheMonitor/www/memcachestat.php @@ -72,7 +72,7 @@ function humanreadable($input) { -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); // Make sure that the user has admin access rights SimpleSAML\Utils\Auth::requireAdmin(); diff --git a/modules/metarefresh/bin/metarefresh.php b/modules/metarefresh/bin/metarefresh.php index bad5c37a0..43ecebd4f 100755 --- a/modules/metarefresh/bin/metarefresh.php +++ b/modules/metarefresh/bin/metarefresh.php @@ -22,7 +22,7 @@ if(!SimpleSAML\Module::isModuleEnabled('metarefresh')) { /* Initialize the configuration. */ $configdir = SimpleSAML\Utils\Config::getConfigDir(); -SimpleSAML_Configuration::setConfigDir($configdir); +\SimpleSAML\Configuration::setConfigDir($configdir); /* $outputDir contains the directory we will store the generated metadata in. */ $outputDir = $baseDir . '/metadata-generated'; diff --git a/modules/metarefresh/hooks/hook_cron.php b/modules/metarefresh/hooks/hook_cron.php index a84539601..cc450c9d4 100644 --- a/modules/metarefresh/hooks/hook_cron.php +++ b/modules/metarefresh/hooks/hook_cron.php @@ -12,8 +12,8 @@ function metarefresh_hook_cron(&$croninfo) { SimpleSAML\Logger::info('cron [metarefresh]: Running cron in cron tag [' . $croninfo['tag'] . '] '); try { - $config = SimpleSAML_Configuration::getInstance(); - $mconfig = SimpleSAML_Configuration::getOptionalConfig('config-metarefresh.php'); + $config = \SimpleSAML\Configuration::getInstance(); + $mconfig = \SimpleSAML\Configuration::getOptionalConfig('config-metarefresh.php'); $sets = $mconfig->getConfigList('sets', array()); $stateFile = $config->getPathValue('datadir', 'data/') . 'metarefresh-state.php'; @@ -103,7 +103,7 @@ function metarefresh_hook_cron(&$croninfo) { } if ($set->hasValue('arp')) { - $arpconfig = SimpleSAML_Configuration::loadFromArray($set->getValue('arp')); + $arpconfig = \SimpleSAML\Configuration::loadFromArray($set->getValue('arp')); $metaloader->writeARPfile($arpconfig); } } diff --git a/modules/metarefresh/lib/ARP.php b/modules/metarefresh/lib/ARP.php index 2af8e7680..c0e3378ac 100644 --- a/modules/metarefresh/lib/ARP.php +++ b/modules/metarefresh/lib/ARP.php @@ -52,7 +52,7 @@ class sspmod_metarefresh_ARP */ private function loadAttributeMap($attributemap) { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); include($config->getPathValue('attributemap', 'attributemap/') . $attributemap . '.php'); // Note that $attributemap was a string before the call to include() and is now an array! $this->attributes = $attributemap; diff --git a/modules/metarefresh/lib/MetaLoader.php b/modules/metarefresh/lib/MetaLoader.php index 0635cdd61..4d1cf818a 100644 --- a/modules/metarefresh/lib/MetaLoader.php +++ b/modules/metarefresh/lib/MetaLoader.php @@ -194,7 +194,7 @@ class sspmod_metarefresh_MetaLoader */ private function createContext($source) { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $name = $config->getString('technicalcontact_name', null); $mail = $config->getString('technicalcontact_email', null); @@ -365,7 +365,7 @@ class sspmod_metarefresh_MetaLoader */ public function writeARPfile($config) { - assert($config instanceof SimpleSAML_Configuration); + assert($config instanceof \SimpleSAML\Configuration); $arpfile = $config->getValue('arpfile'); $types = array('saml20-sp-remote'); diff --git a/modules/metarefresh/www/fetch.php b/modules/metarefresh/www/fetch.php index 097fb85c0..44d9b110e 100644 --- a/modules/metarefresh/www/fetch.php +++ b/modules/metarefresh/www/fetch.php @@ -1,7 +1,7 @@ <?php -$config = SimpleSAML_Configuration::getInstance(); -$mconfig = SimpleSAML_Configuration::getOptionalConfig('config-metarefresh.php'); +$config = \SimpleSAML\Configuration::getInstance(); +$mconfig = \SimpleSAML\Configuration::getOptionalConfig('config-metarefresh.php'); SimpleSAML\Utils\Auth::requireAdmin(); @@ -91,4 +91,4 @@ $logentries = SimpleSAML\Logger::getCapturedLog(); $t = new SimpleSAML_XHTML_Template($config, 'metarefresh:fetch.tpl.php'); $t->data['logentries'] = $logentries; -$t->show(); \ No newline at end of file +$t->show(); diff --git a/modules/multiauth/lib/Auth/Source/MultiAuth.php b/modules/multiauth/lib/Auth/Source/MultiAuth.php index f63bcce9d..f04c09831 100644 --- a/modules/multiauth/lib/Auth/Source/MultiAuth.php +++ b/modules/multiauth/lib/Auth/Source/MultiAuth.php @@ -52,9 +52,9 @@ class sspmod_multiauth_Auth_Source_MultiAuth extends SimpleSAML_Auth_Source { throw new Exception('The required "sources" config option was not found'); } - $globalConfiguration = SimpleSAML_Configuration::getInstance(); + $globalConfiguration = \SimpleSAML\Configuration::getInstance(); $defaultLanguage = $globalConfiguration->getString('language.default', 'en'); - $authsources = SimpleSAML_Configuration::getConfig('authsources.php'); + $authsources = \SimpleSAML\Configuration::getConfig('authsources.php'); $this->sources = array(); foreach($config['sources'] as $source => $info) { @@ -204,7 +204,7 @@ class sspmod_multiauth_Auth_Source_MultiAuth extends SimpleSAML_Auth_Source { $cookieName = 'multiauth_source_' . $this->authId; - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $params = array( /* We save the cookies for 90 days. */ 'lifetime' => (60*60*24*90), diff --git a/modules/multiauth/www/selectsource.php b/modules/multiauth/www/selectsource.php index db09029f8..791db0227 100644 --- a/modules/multiauth/www/selectsource.php +++ b/modules/multiauth/www/selectsource.php @@ -47,7 +47,7 @@ if (array_key_exists('multiauth:preselect', $state)) { sspmod_multiauth_Auth_Source_MultiAuth::delegateAuthentication($source, $state); } -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'multiauth:selectsource.php'); $t->data['authstate'] = $authStateId; $t->data['sources'] = $state[sspmod_multiauth_Auth_Source_MultiAuth::SOURCESID]; diff --git a/modules/negotiate/lib/Auth/Source/Negotiate.php b/modules/negotiate/lib/Auth/Source/Negotiate.php index c1d56500d..f54d7551c 100644 --- a/modules/negotiate/lib/Auth/Source/Negotiate.php +++ b/modules/negotiate/lib/Auth/Source/Negotiate.php @@ -9,7 +9,6 @@ */ class sspmod_negotiate_Auth_Source_Negotiate extends SimpleSAML_Auth_Source { - // Constants used in the module const STAGEID = 'sspmod_negotiate_Auth_Source_Negotiate.StageId'; @@ -50,7 +49,7 @@ class sspmod_negotiate_Auth_Source_Negotiate extends SimpleSAML_Auth_Source // call the parent constructor first, as required by the interface parent::__construct($info, $config); - $config = SimpleSAML_Configuration::loadFromArray($config); + $config = \SimpleSAML\Configuration::loadFromArray($config); $this->backend = $config->getString('fallback'); $this->hostname = $config->getString('hostname'); diff --git a/modules/negotiate/www/disable.php b/modules/negotiate/www/disable.php index 9cf8c592b..bd9fbc76f 100644 --- a/modules/negotiate/www/disable.php +++ b/modules/negotiate/www/disable.php @@ -15,7 +15,7 @@ $params = array( ); \SimpleSAML\Utils\HTTP::setCookie('NEGOTIATE_AUTOLOGIN_DISABLE_PERMANENT', 'True', $params, FALSE); -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); $session->setData('negotiate:disable', 'session', FALSE, 24*60*60); $t = new SimpleSAML_XHTML_Template($globalConfig, 'negotiate:disable.php'); diff --git a/modules/negotiate/www/enable.php b/modules/negotiate/www/enable.php index 04c5e16ff..68b8e5af8 100644 --- a/modules/negotiate/www/enable.php +++ b/modules/negotiate/www/enable.php @@ -14,7 +14,7 @@ $params = array( ); \SimpleSAML\Utils\HTTP::setCookie('NEGOTIATE_AUTOLOGIN_DISABLE_PERMANENT', NULL, $params, FALSE); -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); $session->setData('negotiate:disable', 'session', FALSE, 24*60*60); $t = new SimpleSAML_XHTML_Template($globalConfig, 'negotiate:enable.php'); diff --git a/modules/oauth/hooks/hook_cron.php b/modules/oauth/hooks/hook_cron.php index 182c51a69..cb626e387 100644 --- a/modules/oauth/hooks/hook_cron.php +++ b/modules/oauth/hooks/hook_cron.php @@ -9,7 +9,7 @@ function oauth_hook_cron(&$croninfo) { assert(array_key_exists('summary', $croninfo)); assert(array_key_exists('tag', $croninfo)); - $oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_statistics.php'); + $oauthconfig = \SimpleSAML\Configuration::getOptionalConfig('module_statistics.php'); if (is_null($oauthconfig->getValue('cron_tag', 'hourly'))) return; if ($oauthconfig->getValue('cron_tag', NULL) !== $croninfo['tag']) return; diff --git a/modules/oauth/lib/OAuthStore.php b/modules/oauth/lib/OAuthStore.php index 6bc5f1b43..7ef2141f3 100644 --- a/modules/oauth/lib/OAuthStore.php +++ b/modules/oauth/lib/OAuthStore.php @@ -30,7 +30,7 @@ class sspmod_oauth_OAuthStore extends OAuthDataStore public function __construct() { $this->store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); - $this->config = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); + $this->config = \SimpleSAML\Configuration::getOptionalConfig('module_oauth.php'); } diff --git a/modules/oauth/www/getUserInfo.php b/modules/oauth/www/getUserInfo.php index 516b06544..0389436eb 100644 --- a/modules/oauth/www/getUserInfo.php +++ b/modules/oauth/www/getUserInfo.php @@ -2,7 +2,7 @@ require_once(dirname(dirname(__FILE__)) . '/libextinc/OAuth.php'); -$oauthconfig = SimpleSAML_Configuration::getConfig('module_oauth.php'); +$oauthconfig = \SimpleSAML\Configuration::getConfig('module_oauth.php'); if (!$oauthconfig->getBoolean('getUserInfo.enable', FALSE)) { throw new Exception('Get user info endpoint is disabled. This endpoint can be enabled in the module_oauth.php configuration file.'); diff --git a/modules/oauth/www/registry.edit.php b/modules/oauth/www/registry.edit.php index ef8e42ff4..629f63e71 100644 --- a/modules/oauth/www/registry.edit.php +++ b/modules/oauth/www/registry.edit.php @@ -1,9 +1,9 @@ <?php // Load SimpleSAMLphp, configuration and metadata -$config = SimpleSAML_Configuration::getInstance(); -$session = SimpleSAML_Session::getSessionFromRequest(); -$oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); +$config = \SimpleSAML\Configuration::getInstance(); +$session = \SimpleSAML_Session::getSessionFromRequest(); +$oauthconfig = \SimpleSAML\Configuration::getOptionalConfig('module_oauth.php'); $store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); diff --git a/modules/oauth/www/registry.php b/modules/oauth/www/registry.php index b53a76f9e..ad7c57347 100644 --- a/modules/oauth/www/registry.php +++ b/modules/oauth/www/registry.php @@ -1,9 +1,9 @@ <?php // Load SimpleSAMLphp, configuration and metadata -$config = SimpleSAML_Configuration::getInstance(); -$session = SimpleSAML_Session::getSessionFromRequest(); -$oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); +$config = \SimpleSAML\Configuration::getInstance(); +$session = \SimpleSAML_Session::getSessionFromRequest(); +$oauthconfig = \SimpleSAML\Configuration::getOptionalConfig('module_oauth.php'); $store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); diff --git a/modules/portal/hooks/hook_htmlinject.php b/modules/portal/hooks/hook_htmlinject.php index 3abbf8898..88a7d63e4 100644 --- a/modules/portal/hooks/hook_htmlinject.php +++ b/modules/portal/hooks/hook_htmlinject.php @@ -14,7 +14,7 @@ function portal_hook_htmlinject(&$hookinfo) { $links = array('links' => array()); SimpleSAML\Module::callHooks('frontpage', $links); - $portalConfig = SimpleSAML_Configuration::getOptionalConfig('module_portal.php'); + $portalConfig = \SimpleSAML\Configuration::getOptionalConfig('module_portal.php'); $allLinks = array(); foreach($links AS $ls) { diff --git a/modules/portal/lib/Portal.php b/modules/portal/lib/Portal.php index 9cb25a2c4..f12e4062b 100644 --- a/modules/portal/lib/Portal.php +++ b/modules/portal/lib/Portal.php @@ -43,7 +43,7 @@ class sspmod_portal_Portal public function getMenu($thispage) { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML\Locale\Translate($config); $tabset = $this->getTabset($thispage); $logininfo = $this->getLoginInfo($t, $thispage); diff --git a/modules/preprodwarning/www/showwarning.php b/modules/preprodwarning/www/showwarning.php index 474901838..4d5fcf375 100644 --- a/modules/preprodwarning/www/showwarning.php +++ b/modules/preprodwarning/www/showwarning.php @@ -24,7 +24,7 @@ if (array_key_exists('yes', $_REQUEST)) { -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'preprodwarning:warning.php'); $t->data['yesTarget'] = SimpleSAML\Module::getModuleURL('preprodwarning/showwarning.php'); diff --git a/modules/radius/lib/Auth/Source/Radius.php b/modules/radius/lib/Auth/Source/Radius.php index 649df807b..ace5e01c3 100644 --- a/modules/radius/lib/Auth/Source/Radius.php +++ b/modules/radius/lib/Auth/Source/Radius.php @@ -80,7 +80,7 @@ class sspmod_radius_Auth_Source_Radius extends sspmod_core_Auth_UserPassBase parent::__construct($info, $config); // Parse configuration. - $config = SimpleSAML_Configuration::loadFromArray($config, + $config = \SimpleSAML\Configuration::loadFromArray($config, 'Authentication source ' . var_export($this->authId, true)); $this->servers = $config->getArray('servers', array()); diff --git a/modules/riak/lib/Store/Store.php b/modules/riak/lib/Store/Store.php index baa440393..86d41e0c9 100644 --- a/modules/riak/lib/Store/Store.php +++ b/modules/riak/lib/Store/Store.php @@ -29,7 +29,7 @@ class sspmod_riak_Store_Store extends SimpleSAML\Store protected function __construct() { - $config = SimpleSAML_Configuration::getConfig('module_riak.php'); + $config = \SimpleSAML\Configuration::getConfig('module_riak.php'); $path = $config->getString('path', 'riak-php-client/riak.php'); $host = $config->getString('host', 'localhost'); diff --git a/modules/saml/lib/Auth/Source/SP.php b/modules/saml/lib/Auth/Source/SP.php index 6d3250254..23de5db8e 100644 --- a/modules/saml/lib/Auth/Source/SP.php +++ b/modules/saml/lib/Auth/Source/SP.php @@ -12,7 +12,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source /** * The metadata of this SP. * - * @var SimpleSAML_Configuration. + * @var \SimpleSAML\Configuration */ private $metadata; @@ -52,7 +52,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source * gives the entity id. */ $config['entityid'] = $config['entityID']; - $this->metadata = SimpleSAML_Configuration::loadFromArray($config, + $this->metadata = \SimpleSAML\Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, true) . ']'); $this->entityId = $this->metadata->getString('entityID'); $this->idp = $this->metadata->getString('idp', null); @@ -86,7 +86,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source /** * Retrieve the metadata of this SP. * - * @return SimpleSAML_Configuration The metadata of this SP. + * @return \SimpleSAML\Configuration The metadata of this SP. */ public function getMetadata() { @@ -97,7 +97,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source * Retrieve the metadata of an IdP. * * @param string $entityId The entity id of the IdP. - * @return SimpleSAML_Configuration The metadata of the IdP. + * @return \SimpleSAML\Configuration The metadata of the IdP. */ public function getIdPMetadata($entityId) { @@ -135,10 +135,10 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source /** * Send a SAML1 SSO request to an IdP. * - * @param SimpleSAML_Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. * @param array $state The state array for the current authentication. */ - private function startSSO1(SimpleSAML_Configuration $idpMetadata, array $state) + private function startSSO1(\SimpleSAML\Configuration $idpMetadata, array $state) { $idpEntityId = $idpMetadata->getString('entityid'); @@ -171,10 +171,10 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source /** * Send a SAML2 SSO request to an IdP. * - * @param SimpleSAML_Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. * @param array $state The state array for the current authentication. */ - private function startSSO2(SimpleSAML_Configuration $idpMetadata, array $state) + private function startSSO2(\SimpleSAML\Configuration $idpMetadata, array $state) { if (isset($state['saml:ProxyCount']) && $state['saml:ProxyCount'] < 0) { SimpleSAML_Auth_State::throwException( @@ -510,7 +510,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source * * @param array $state The state array. * The following keys must be defined in the array: - * - 'saml:sp:IdPMetadata': a SimpleSAML_Configuration object containing + * - 'saml:sp:IdPMetadata': a \SimpleSAML\Configuration object containing * the metadata of the IdP that authenticated the user in the current * session. * - 'saml:sp:AuthId': the identifier of the current authentication source. diff --git a/modules/saml/lib/IdP/SAML1.php b/modules/saml/lib/IdP/SAML1.php index fcd3603ce..a35c62574 100644 --- a/modules/saml/lib/IdP/SAML1.php +++ b/modules/saml/lib/IdP/SAML1.php @@ -22,7 +22,7 @@ class sspmod_saml_IdP_SAML1 $spMetadata = $state["SPMetadata"]; $spEntityId = $spMetadata['entityid']; - $spMetadata = SimpleSAML_Configuration::loadFromArray($spMetadata, + $spMetadata = \SimpleSAML\Configuration::loadFromArray($spMetadata, '$metadata[' . var_export($spEntityId, true) . ']'); SimpleSAML\Logger::info('Sending SAML 1.1 Response to ' . var_export($spEntityId, true)); @@ -35,7 +35,7 @@ class sspmod_saml_IdP_SAML1 $idpMetadata = $idp->getConfig(); - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $statsData = array( diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php index 9c6860585..c450b2f36 100644 --- a/modules/saml/lib/IdP/SAML2.php +++ b/modules/saml/lib/IdP/SAML2.php @@ -1,6 +1,7 @@ <?php use RobRichards\XMLSecLibs\XMLSecurityKey; +use SimpleSAML\Configuration; use SAML2\SOAP; /** @@ -26,7 +27,7 @@ class sspmod_saml_IdP_SAML2 $spMetadata = $state["SPMetadata"]; $spEntityId = $spMetadata['entityid']; - $spMetadata = SimpleSAML_Configuration::loadFromArray( + $spMetadata = Configuration::loadFromArray( $spMetadata, '$metadata['.var_export($spEntityId, true).']' ); @@ -102,7 +103,7 @@ class sspmod_saml_IdP_SAML2 $spMetadata = $state["SPMetadata"]; $spEntityId = $spMetadata['entityid']; - $spMetadata = SimpleSAML_Configuration::loadFromArray( + $spMetadata = Configuration::loadFromArray( $spMetadata, '$metadata['.var_export($spEntityId, true).']' ); @@ -151,17 +152,17 @@ class sspmod_saml_IdP_SAML2 /** * Find SP AssertionConsumerService based on parameter in AuthnRequest. * - * @param array $supportedBindings The bindings we allow for the response. - * @param SimpleSAML_Configuration $spMetadata The metadata for the SP. - * @param string|NULL $AssertionConsumerServiceURL AssertionConsumerServiceURL from request. - * @param string|NULL $ProtocolBinding ProtocolBinding from request. - * @param int|NULL $AssertionConsumerServiceIndex AssertionConsumerServiceIndex from request. + * @param array $supportedBindings The bindings we allow for the response. + * @param \SimpleSAML\Configuration $spMetadata The metadata for the SP. + * @param string|NULL $AssertionConsumerServiceURL AssertionConsumerServiceURL from request. + * @param string|NULL $ProtocolBinding ProtocolBinding from request. + * @param int|NULL $AssertionConsumerServiceIndex AssertionConsumerServiceIndex from request. * * @return array Array with the Location and Binding we should use for the response. */ private static function getAssertionConsumerService( array $supportedBindings, - SimpleSAML_Configuration $spMetadata, + Configuration $spMetadata, $AssertionConsumerServiceURL, $ProtocolBinding, $AssertionConsumerServiceIndex @@ -666,7 +667,7 @@ class sspmod_saml_IdP_SAML2 * @param SimpleSAML_IdP $idp The IdP the association belongs to. * @param array $association The SP association. * - * @return SimpleSAML_Configuration Configuration object for the SP metadata. + * @return \SimpleSAML\Configuration Configuration object for the SP metadata. */ public static function getAssociationConfig(SimpleSAML_IdP $idp, array $association) { @@ -674,7 +675,7 @@ class sspmod_saml_IdP_SAML2 try { return $metadata->getMetaDataConfig($association['saml:entityID'], 'saml20-sp-remote'); } catch (Exception $e) { - return SimpleSAML_Configuration::loadFromArray(array(), 'Unknown SAML 2 entity.'); + return Configuration::loadFromArray(array(), 'Unknown SAML 2 entity.'); } } @@ -682,15 +683,15 @@ class sspmod_saml_IdP_SAML2 /** * Calculate the NameID value that should be used. * - * @param SimpleSAML_Configuration $idpMetadata The metadata of the IdP. - * @param SimpleSAML_Configuration $spMetadata The metadata of the SP. - * @param array &$state The authentication state of the user. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. + * @param array &$state The authentication state of the user. * * @return string The NameID value. */ private static function generateNameIdValue( - SimpleSAML_Configuration $idpMetadata, - SimpleSAML_Configuration $spMetadata, + Configuration $idpMetadata, + Configuration $spMetadata, array &$state ) { @@ -732,8 +733,8 @@ class sspmod_saml_IdP_SAML2 /** * Helper function for encoding attributes. * - * @param SimpleSAML_Configuration $idpMetadata The metadata of the IdP. - * @param SimpleSAML_Configuration $spMetadata The metadata of the SP. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. * @param array $attributes The attributes of the user. * * @return array The encoded attributes. @@ -741,8 +742,8 @@ class sspmod_saml_IdP_SAML2 * @throws SimpleSAML_Error_Exception In case an unsupported encoding is specified by configuration. */ private static function encodeAttributes( - SimpleSAML_Configuration $idpMetadata, - SimpleSAML_Configuration $spMetadata, + Configuration $idpMetadata, + Configuration $spMetadata, array $attributes ) { @@ -816,14 +817,14 @@ class sspmod_saml_IdP_SAML2 /** * Determine which NameFormat we should use for attributes. * - * @param SimpleSAML_Configuration $idpMetadata The metadata of the IdP. - * @param SimpleSAML_Configuration $spMetadata The metadata of the SP. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. * * @return string The NameFormat. */ private static function getAttributeNameFormat( - SimpleSAML_Configuration $idpMetadata, - SimpleSAML_Configuration $spMetadata + Configuration $idpMetadata, + Configuration $spMetadata ) { // try SP metadata first @@ -854,8 +855,8 @@ class sspmod_saml_IdP_SAML2 /** * Build an assertion based on information in the metadata. * - * @param SimpleSAML_Configuration $idpMetadata The metadata of the IdP. - * @param SimpleSAML_Configuration $spMetadata The metadata of the SP. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. * @param array &$state The state array with information about the request. * * @return \SAML2\Assertion The assertion. @@ -863,8 +864,8 @@ class sspmod_saml_IdP_SAML2 * @throws SimpleSAML_Error_Exception In case an error occurs when creating a holder-of-key assertion. */ private static function buildAssertion( - SimpleSAML_Configuration $idpMetadata, - SimpleSAML_Configuration $spMetadata, + Configuration $idpMetadata, + Configuration $spMetadata, array &$state ) { assert(isset($state['Attributes'])); @@ -877,7 +878,7 @@ class sspmod_saml_IdP_SAML2 $signAssertion = $idpMetadata->getBoolean('saml20.sign.assertion', true); } - $config = SimpleSAML_Configuration::getInstance(); + $config = Configuration::getInstance(); $a = new \SAML2\Assertion(); if ($signAssertion) { @@ -1043,17 +1044,17 @@ class sspmod_saml_IdP_SAML2 * This function takes in a \SAML2\Assertion and encrypts it if encryption of * assertions are enabled in the metadata. * - * @param SimpleSAML_Configuration $idpMetadata The metadata of the IdP. - * @param SimpleSAML_Configuration $spMetadata The metadata of the SP. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. * @param \SAML2\Assertion $assertion The assertion we are encrypting. * * @return \SAML2\Assertion|\SAML2\EncryptedAssertion The assertion. * - * @throws SimpleSAML_Error_Exception In case the encryption key type is not supported. + * @throws \SimpleSAML_Error_Exception In case the encryption key type is not supported. */ private static function encryptAssertion( - SimpleSAML_Configuration $idpMetadata, - SimpleSAML_Configuration $spMetadata, + Configuration $idpMetadata, + Configuration $spMetadata, \SAML2\Assertion $assertion ) { @@ -1089,7 +1090,7 @@ class sspmod_saml_IdP_SAML2 $key = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, array('type' => 'public')); $key->loadKey($pemKey); } else { - throw new SimpleSAML_Error_ConfigurationError( + throw new \SimpleSAML_Error_ConfigurationError( 'Missing encryption key for entity `' . $spMetadata->getString('entityid') . '`', null, $spMetadata->getString('metadata-set') . '.php' @@ -1106,16 +1107,16 @@ class sspmod_saml_IdP_SAML2 /** * Build a logout request based on information in the metadata. * - * @param SimpleSAML_Configuration $idpMetadata The metadata of the IdP. - * @param SimpleSAML_Configuration $spMetadata The metadata of the SP. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. * @param array $association The SP association. * @param string|null $relayState An id that should be carried across the logout. * * @return \SAML2\LogoutResponse The corresponding SAML2 logout response. */ private static function buildLogoutRequest( - SimpleSAML_Configuration $idpMetadata, - SimpleSAML_Configuration $spMetadata, + Configuration $idpMetadata, + Configuration $spMetadata, array $association, $relayState ) { @@ -1146,15 +1147,15 @@ class sspmod_saml_IdP_SAML2 /** * Build a authentication response based on information in the metadata. * - * @param SimpleSAML_Configuration $idpMetadata The metadata of the IdP. - * @param SimpleSAML_Configuration $spMetadata The metadata of the SP. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. * @param string $consumerURL The Destination URL of the response. * * @return \SAML2\Response The SAML2 response corresponding to the given data. */ private static function buildResponse( - SimpleSAML_Configuration $idpMetadata, - SimpleSAML_Configuration $spMetadata, + Configuration $idpMetadata, + Configuration $spMetadata, $consumerURL ) { diff --git a/modules/saml/lib/Message.php b/modules/saml/lib/Message.php index b93255517..cf5f5c6ef 100644 --- a/modules/saml/lib/Message.php +++ b/modules/saml/lib/Message.php @@ -1,6 +1,7 @@ <?php use RobRichards\XMLSecLibs\XMLSecurityKey; +use SimpleSAML\Configuration; /** * Common code for building SAML 2 messages based on the available metadata. @@ -13,13 +14,13 @@ class sspmod_saml_Message /** * Add signature key and sender certificate to an element (Message or Assertion). * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender. - * @param SimpleSAML_Configuration $dstMetadata The metadata of the recipient. + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender. + * @param \SimpleSAML\Configuration $dstMetadata The metadata of the recipient. * @param \SAML2\SignedElement $element The element we should add the data to. */ public static function addSign( - SimpleSAML_Configuration $srcMetadata, - SimpleSAML_Configuration $dstMetadata, + Configuration $srcMetadata, + Configuration $dstMetadata, \SAML2\SignedElement $element ) { $dstPrivateKey = $dstMetadata->getString('signature.privatekey', null); @@ -62,13 +63,13 @@ class sspmod_saml_Message /** * Add signature key and and senders certificate to message. * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender. - * @param SimpleSAML_Configuration $dstMetadata The metadata of the recipient. + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender. + * @param \SimpleSAML\Configuration $dstMetadata The metadata of the recipient. * @param \SAML2\Message $message The message we should add the data to. */ private static function addRedirectSign( - SimpleSAML_Configuration $srcMetadata, - SimpleSAML_Configuration $dstMetadata, + Configuration $srcMetadata, + Configuration $dstMetadata, \SAML2\Message $message ) { @@ -139,14 +140,14 @@ class sspmod_saml_Message /** * Check the signature on a SAML2 message or assertion. * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender. + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender. * @param \SAML2\SignedElement $element Either a \SAML2\Response or a \SAML2\Assertion. * @return boolean True if the signature is correct, false otherwise. * * @throws \SimpleSAML_Error_Exception if there is not certificate in the metadata for the entity. * @throws \Exception if the signature validation fails with an exception. */ - public static function checkSign(SimpleSAML_Configuration $srcMetadata, \SAML2\SignedElement $element) + public static function checkSign(Configuration $srcMetadata, \SAML2\SignedElement $element) { // find the public key that should verify signatures by this entity $keys = $srcMetadata->getPublicKeys('signing'); @@ -227,15 +228,15 @@ class sspmod_saml_Message /** * Check signature on a SAML2 message if enabled. * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender. - * @param SimpleSAML_Configuration $dstMetadata The metadata of the recipient. + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender. + * @param \SimpleSAML\Configuration $dstMetadata The metadata of the recipient. * @param \SAML2\Message $message The message we should check the signature on. * * @throws \SimpleSAML_Error_Exception if message validation is enabled, but there is no signature in the message. */ public static function validateMessage( - SimpleSAML_Configuration $srcMetadata, - SimpleSAML_Configuration $dstMetadata, + Configuration $srcMetadata, + Configuration $dstMetadata, \SAML2\Message $message ) { $enabled = null; @@ -273,14 +274,14 @@ class sspmod_saml_Message /** * Retrieve the decryption keys from metadata. * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender (IdP). - * @param SimpleSAML_Configuration $dstMetadata The metadata of the recipient (SP). + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender (IdP). + * @param \SimpleSAML\Configuration $dstMetadata The metadata of the recipient (SP). * * @return array Array of decryption keys. */ public static function getDecryptionKeys( - SimpleSAML_Configuration $srcMetadata, - SimpleSAML_Configuration $dstMetadata + Configuration $srcMetadata, + Configuration $dstMetadata ) { $sharedKey = $srcMetadata->getString('sharedkey', null); if ($sharedKey !== null) { @@ -324,14 +325,14 @@ class sspmod_saml_Message * * Remote configuration overrides local configuration. * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender. - * @param SimpleSAML_Configuration $dstMetadata The metadata of the recipient. + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender. + * @param \SimpleSAML\Configuration $dstMetadata The metadata of the recipient. * * @return array Array of blacklisted algorithms. */ public static function getBlacklistedAlgorithms( - SimpleSAML_Configuration $srcMetadata, - SimpleSAML_Configuration $dstMetadata + Configuration $srcMetadata, + Configuration $dstMetadata ) { $blacklist = $srcMetadata->getArray('encryption.blacklisted-algorithms', null); if ($blacklist === null) { @@ -344,8 +345,8 @@ class sspmod_saml_Message /** * Decrypt an assertion. * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender (IdP). - * @param SimpleSAML_Configuration $dstMetadata The metadata of the recipient (SP). + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender (IdP). + * @param \SimpleSAML\Configuration $dstMetadata The metadata of the recipient (SP). * @param \SAML2\Assertion|\SAML2\EncryptedAssertion $assertion The assertion we are decrypting. * * @return \SAML2\Assertion The assertion. @@ -355,8 +356,8 @@ class sspmod_saml_Message * @throws \Exception if decryption fails for whatever reason. */ private static function decryptAssertion( - SimpleSAML_Configuration $srcMetadata, - SimpleSAML_Configuration $dstMetadata, + Configuration $srcMetadata, + Configuration $dstMetadata, $assertion ) { assert($assertion instanceof \SAML2\Assertion || $assertion instanceof \SAML2\EncryptedAssertion); @@ -400,8 +401,8 @@ class sspmod_saml_Message /** * Decrypt any encrypted attributes in an assertion. * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender (IdP). - * @param SimpleSAML_Configuration $dstMetadata The metadata of the recipient (SP). + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender (IdP). + * @param \SimpleSAML\Configuration $dstMetadata The metadata of the recipient (SP). * @param \SAML2\Assertion|\SAML2\Assertion $assertion The assertion containing any possibly encrypted attributes. * * @return void @@ -409,8 +410,8 @@ class sspmod_saml_Message * @throws \SimpleSAML_Error_Exception if we cannot get the decryption keys or decryption fails. */ private static function decryptAttributes( - SimpleSAML_Configuration $srcMetadata, - SimpleSAML_Configuration $dstMetadata, + Configuration $srcMetadata, + Configuration $dstMetadata, \SAML2\Assertion &$assertion ) { if (!$assertion->hasEncryptedAttributes()) { @@ -459,13 +460,13 @@ class sspmod_saml_Message /** * Build an authentication request based on information in the metadata. * - * @param SimpleSAML_Configuration $spMetadata The metadata of the service provider. - * @param SimpleSAML_Configuration $idpMetadata The metadata of the identity provider. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the service provider. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the identity provider. * @return \SAML2\AuthnRequest An authentication request object. */ public static function buildAuthnRequest( - SimpleSAML_Configuration $spMetadata, - SimpleSAML_Configuration $idpMetadata + Configuration $spMetadata, + Configuration $idpMetadata ) { $ar = new \SAML2\AuthnRequest(); @@ -482,7 +483,7 @@ class sspmod_saml_Message $nameIdPolicy = array('Format' => $nameIdPolicy); } - $nameIdPolicy_cf = SimpleSAML_Configuration::loadFromArray($nameIdPolicy); + $nameIdPolicy_cf = Configuration::loadFromArray($nameIdPolicy); $policy = array( 'Format' => $nameIdPolicy_cf->getString('Format', \SAML2\Constants::NAMEID_TRANSIENT), 'AllowCreate' => $nameIdPolicy_cf->getBoolean('AllowCreate', true), @@ -529,13 +530,13 @@ class sspmod_saml_Message /** * Build a logout request based on information in the metadata. * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender. - * @param SimpleSAML_Configuration $dstMetadata The metadata of the recipient. + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender. + * @param \SimpleSAML\Configuration $dstMetadata The metadata of the recipient. * @return \SAML2\LogoutRequest A logout request object. */ public static function buildLogoutRequest( - SimpleSAML_Configuration $srcMetadata, - SimpleSAML_Configuration $dstMetadata + Configuration $srcMetadata, + Configuration $dstMetadata ) { $lr = new \SAML2\LogoutRequest(); $lr->setIssuer($srcMetadata->getString('entityid')); @@ -549,13 +550,13 @@ class sspmod_saml_Message /** * Build a logout response based on information in the metadata. * - * @param SimpleSAML_Configuration $srcMetadata The metadata of the sender. - * @param SimpleSAML_Configuration $dstMetadata The metadata of the recipient. + * @param \SimpleSAML\Configuration $srcMetadata The metadata of the sender. + * @param \SimpleSAML\Configuration $dstMetadata The metadata of the recipient. * @return \SAML2\LogoutResponse A logout response object. */ public static function buildLogoutResponse( - SimpleSAML_Configuration $srcMetadata, - SimpleSAML_Configuration $dstMetadata + Configuration $srcMetadata, + Configuration $dstMetadata ) { $lr = new \SAML2\LogoutResponse(); $lr->setIssuer($srcMetadata->getString('entityid')); @@ -571,8 +572,8 @@ class sspmod_saml_Message * * If the response is an error response, we will throw a sspmod_saml_Error exception with the error. * - * @param SimpleSAML_Configuration $spMetadata The metadata of the service provider. - * @param SimpleSAML_Configuration $idpMetadata The metadata of the identity provider. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the service provider. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the identity provider. * @param \SAML2\Response $response The response. * * @return array Array with \SAML2\Assertion objects, containing valid assertions from the response. @@ -581,8 +582,8 @@ class sspmod_saml_Message * @throws \Exception if the destination of the response does not match the current URL. */ public static function processResponse( - SimpleSAML_Configuration $spMetadata, - SimpleSAML_Configuration $idpMetadata, + Configuration $spMetadata, + Configuration $idpMetadata, \SAML2\Response $response ) { if (!$response->isSuccess()) { @@ -620,8 +621,8 @@ class sspmod_saml_Message /** * Process an assertion in a response. * - * @param SimpleSAML_Configuration $spMetadata The metadata of the service provider. - * @param SimpleSAML_Configuration $idpMetadata The metadata of the identity provider. + * @param \SimpleSAML\Configuration $spMetadata The metadata of the service provider. + * @param \SimpleSAML\Configuration $idpMetadata The metadata of the identity provider. * @param \SAML2\Response $response The response containing the assertion. * @param \SAML2\Assertion|\SAML2\EncryptedAssertion $assertion The assertion. * @param bool $responseSigned Whether the response is signed. @@ -634,8 +635,8 @@ class sspmod_saml_Message * @throws \Exception if we couldn't decrypt the NameID for unexpected reasons. */ private static function processAssertion( - SimpleSAML_Configuration $spMetadata, - SimpleSAML_Configuration $idpMetadata, + Configuration $spMetadata, + Configuration $idpMetadata, \SAML2\Response $response, $assertion, $responseSigned @@ -856,13 +857,13 @@ class sspmod_saml_Message /** * Retrieve the encryption key for the given entity. * - * @param SimpleSAML_Configuration $metadata The metadata of the entity. + * @param \SimpleSAML\Configuration $metadata The metadata of the entity. * * @return \RobRichards\XMLSecLibs\XMLSecurityKey The encryption key. * * @throws \SimpleSAML_Error_Exception if there is no supported encryption key in the metadata of this entity. */ - public static function getEncryptionKey(SimpleSAML_Configuration $metadata) + public static function getEncryptionKey(Configuration $metadata) { $sharedKey = $metadata->getString('sharedkey', null); diff --git a/modules/saml/www/idp/certs.php b/modules/saml/www/idp/certs.php index adbfcc80d..b7646b679 100644 --- a/modules/saml/www/idp/certs.php +++ b/modules/saml/www/idp/certs.php @@ -1,7 +1,7 @@ <?php // Load SimpleSAMLphp, configuration and metadata -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); if (!$config->getBoolean('enable.saml20-idp', false)) { @@ -10,7 +10,7 @@ if (!$config->getBoolean('enable.saml20-idp', false)) { // Check if valid local session exists.. if ($config->getBoolean('admin.protectmetadata', false)) { - SimpleSAML\Utils\Auth::requireAdmin(); + \SimpleSAML\Utils\Auth::requireAdmin(); } $idpentityid = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); diff --git a/modules/saml/www/proxy/invalid_session.php b/modules/saml/www/proxy/invalid_session.php index f110f8beb..30616af13 100644 --- a/modules/saml/www/proxy/invalid_session.php +++ b/modules/saml/www/proxy/invalid_session.php @@ -44,14 +44,14 @@ if (isset($_POST['continue'])) { $as->reauthLogout($state); } -$cfg = SimpleSAML_Configuration::getInstance(); +$cfg = \SimpleSAML\Configuration::getInstance(); $template = new SimpleSAML_XHTML_Template($cfg, 'saml:proxy/invalid_session.php'); $translator = $template->getTranslator(); $template->data['AuthState'] = (string)$_REQUEST['AuthState']; // get the name of the IdP $idpmdcfg = $state['saml:sp:IdPMetadata']; -/** @var SimpleSAML_Configuration $idpmdcfg */ +/** @var \SimpleSAML\Configuration $idpmdcfg */ $idpmd = $idpmdcfg->toArray(); if (array_key_exists('name', $idpmd)) { $template->data['idp_name'] = $translator->getPreferredTranslation($idpmd['name']); diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php index a0b0318ea..9547235cc 100644 --- a/modules/saml/www/sp/metadata.php +++ b/modules/saml/www/sp/metadata.php @@ -4,9 +4,9 @@ if (!array_key_exists('PATH_INFO', $_SERVER)) { throw new SimpleSAML_Error_BadRequest('Missing authentication source id in metadata URL'); } -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); if ($config->getBoolean('admin.protectmetadata', false)) { - SimpleSAML\Utils\Auth::requireAdmin(); + \SimpleSAML\Utils\Auth::requireAdmin(); } $sourceId = substr($_SERVER['PATH_INFO'], 1); $source = SimpleSAML_Auth_Source::getById($sourceId); diff --git a/modules/saml/www/sp/wrong_authncontextclassref.php b/modules/saml/www/sp/wrong_authncontextclassref.php index 18e17617d..490a86a40 100644 --- a/modules/saml/www/sp/wrong_authncontextclassref.php +++ b/modules/saml/www/sp/wrong_authncontextclassref.php @@ -1,5 +1,5 @@ <?php -$globalConfig = SimpleSAML_Configuration::getInstance(); +$globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'saml:sp/wrong_authncontextclassref.tpl.php'); $t->show(); diff --git a/modules/sanitycheck/hooks/hook_cron.php b/modules/sanitycheck/hooks/hook_cron.php index abb2b0ce4..5b6a93869 100644 --- a/modules/sanitycheck/hooks/hook_cron.php +++ b/modules/sanitycheck/hooks/hook_cron.php @@ -10,10 +10,10 @@ function sanitycheck_hook_cron(&$croninfo) assert(array_key_exists('summary', $croninfo)); assert(array_key_exists('tag', $croninfo)); - SimpleSAML\Logger::info('cron [sanitycheck]: Running cron in cron tag [' . $croninfo['tag'] . '] '); + \SimpleSAML\Logger::info('cron [sanitycheck]: Running cron in cron tag [' . $croninfo['tag'] . '] '); try { - $sconfig = SimpleSAML_Configuration::getOptionalConfig('config-sanitycheck.php'); + $sconfig = \SimpleSAML\Configuration::getOptionalConfig('config-sanitycheck.php'); $cronTag = $sconfig->getString('cron_tag', null); if ($cronTag === null || $cronTag !== $croninfo['tag']) { diff --git a/modules/sanitycheck/www/index.php b/modules/sanitycheck/www/index.php index e365db28d..55f70198f 100644 --- a/modules/sanitycheck/www/index.php +++ b/modules/sanitycheck/www/index.php @@ -1,6 +1,6 @@ <?php -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $info = array(); $errors = array(); diff --git a/modules/statistics/bin/loganalyzer.php b/modules/statistics/bin/loganalyzer.php index bf9a16418..d55ded29d 100755 --- a/modules/statistics/bin/loganalyzer.php +++ b/modules/statistics/bin/loganalyzer.php @@ -8,9 +8,9 @@ $baseDir = dirname(dirname(dirname(dirname(__FILE__)))); require_once($baseDir . '/lib/_autoload.php'); // Initialize the configuration. -$configdir = SimpleSAML\Utils\Config::getConfigDir(); -SimpleSAML_Configuration::setConfigDir($configdir); -SimpleSAML\Utils\Time::initTimezone(); +$configdir = \SimpleSAML\Utils\Config::getConfigDir(); +\SimpleSAML\Configuration::setConfigDir($configdir); +\SimpleSAML\Utils\Time::initTimezone(); $progName = array_shift($argv); $debug = false; diff --git a/modules/statistics/bin/logcleaner.php b/modules/statistics/bin/logcleaner.php index b845a1396..c7112267a 100755 --- a/modules/statistics/bin/logcleaner.php +++ b/modules/statistics/bin/logcleaner.php @@ -8,8 +8,8 @@ $baseDir = dirname(dirname(dirname(dirname(__FILE__)))); require_once($baseDir . '/lib/_autoload.php'); // Initialize the configuration. -$configdir = SimpleSAML\Utils\Config::getConfigDir(); -SimpleSAML_Configuration::setConfigDir($configdir); +$configdir = \SimpleSAML\Utils\Config::getConfigDir(); +\SimpleSAML\Configuration::setConfigDir($configdir); $progName = array_shift($argv); $debug = false; diff --git a/modules/statistics/hooks/hook_cron.php b/modules/statistics/hooks/hook_cron.php index ccd95e460..b918991ce 100644 --- a/modules/statistics/hooks/hook_cron.php +++ b/modules/statistics/hooks/hook_cron.php @@ -10,7 +10,7 @@ function statistics_hook_cron(&$croninfo) assert(array_key_exists('summary', $croninfo)); assert(array_key_exists('tag', $croninfo)); - $statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php'); + $statconfig = \SimpleSAML\Configuration::getConfig('module_statistics.php'); if (is_null($statconfig->getValue('cron_tag', null))) { return; diff --git a/modules/statistics/hooks/hook_sanitycheck.php b/modules/statistics/hooks/hook_sanitycheck.php index 9936379c5..1c3783925 100644 --- a/modules/statistics/hooks/hook_sanitycheck.php +++ b/modules/statistics/hooks/hook_sanitycheck.php @@ -11,7 +11,7 @@ function statistics_hook_sanitycheck(&$hookinfo) assert(array_key_exists('info', $hookinfo)); try { - $statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php'); + $statconfig = \SimpleSAML\Configuration::getConfig('module_statistics.php'); } catch(Exception $e) { $hookinfo['errors'][] = '[statistics] Could not get configuration: ' . $e->getMessage(); return; } diff --git a/modules/statistics/lib/AccessCheck.php b/modules/statistics/lib/AccessCheck.php index f742b51d1..65b1f42e3 100644 --- a/modules/statistics/lib/AccessCheck.php +++ b/modules/statistics/lib/AccessCheck.php @@ -12,7 +12,7 @@ class sspmod_statistics_AccessCheck * * If the user doesn't have access, send the user to the login page. */ - public static function checkAccess(SimpleSAML_Configuration $statconfig) + public static function checkAccess(\SimpleSAML\Configuration $statconfig) { $protected = $statconfig->getBoolean('protected', false); $authsource = $statconfig->getString('auth', null); diff --git a/modules/statistics/lib/Aggregator.php b/modules/statistics/lib/Aggregator.php index d943c7fd2..3de80a133 100644 --- a/modules/statistics/lib/Aggregator.php +++ b/modules/statistics/lib/Aggregator.php @@ -21,7 +21,7 @@ class sspmod_statistics_Aggregator public function __construct($fromcmdline = false) { $this->fromcmdline = $fromcmdline; - $this->statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php'); + $this->statconfig = \SimpleSAML\Configuration::getConfig('module_statistics.php'); $this->statdir = $this->statconfig->getValue('statdir'); $this->inputfile = $this->statconfig->getValue('inputfile'); diff --git a/modules/statistics/lib/LogCleaner.php b/modules/statistics/lib/LogCleaner.php index b80a39e53..9d55de9f9 100644 --- a/modules/statistics/lib/LogCleaner.php +++ b/modules/statistics/lib/LogCleaner.php @@ -16,7 +16,7 @@ class sspmod_statistics_LogCleaner */ public function __construct($inputfile = null) { - $this->statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php'); + $this->statconfig = \SimpleSAML\Configuration::getConfig('module_statistics.php'); $this->statdir = $this->statconfig->getValue('statdir'); $this->inputfile = $this->statconfig->getValue('inputfile'); diff --git a/modules/statistics/lib/StatDataset.php b/modules/statistics/lib/StatDataset.php index b30b59bb5..ac56cfc7e 100644 --- a/modules/statistics/lib/StatDataset.php +++ b/modules/statistics/lib/StatDataset.php @@ -29,8 +29,8 @@ class sspmod_statistics_StatDataset */ public function __construct($statconfig, $ruleconfig, $ruleid, $timeres, $fileslot) { - assert($statconfig instanceof SimpleSAML_Configuration); - assert($ruleconfig instanceof SimpleSAML_Configuration); + assert($statconfig instanceof \SimpleSAML\Configuration); + assert($ruleconfig instanceof \SimpleSAML\Configuration); $this->statconfig = $statconfig; $this->ruleconfig = $ruleconfig; @@ -232,7 +232,7 @@ class sspmod_statistics_StatDataset public function getDelimiterPresentation() { - $config = SimpleSAML_Configuration::getInstance(); + $config = \SimpleSAML\Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($config, 'statistics:statistics.tpl.php'); $availdelimiters = $this->availDelimiters(); diff --git a/modules/statistics/lib/Statistics/Rulesets/BaseRule.php b/modules/statistics/lib/Statistics/Rulesets/BaseRule.php index 99b2254fd..09388e52f 100644 --- a/modules/statistics/lib/Statistics/Rulesets/BaseRule.php +++ b/modules/statistics/lib/Statistics/Rulesets/BaseRule.php @@ -15,8 +15,8 @@ class sspmod_statistics_Statistics_Rulesets_BaseRule */ public function __construct($statconfig, $ruleconfig, $ruleid, $available) { - assert($statconfig instanceof SimpleSAML_Configuration); - assert($ruleconfig instanceof SimpleSAML_Configuration); + assert($statconfig instanceof \SimpleSAML\Configuration); + assert($ruleconfig instanceof \SimpleSAML\Configuration); $this->statconfig = $statconfig; $this->ruleconfig = $ruleconfig; $this->ruleid = $ruleid; diff --git a/modules/statistics/lib/Statistics/Rulesets/Ratio.php b/modules/statistics/lib/Statistics/Rulesets/Ratio.php index ceb0ff3d4..923e518db 100644 --- a/modules/statistics/lib/Statistics/Rulesets/Ratio.php +++ b/modules/statistics/lib/Statistics/Rulesets/Ratio.php @@ -13,8 +13,8 @@ class sspmod_statistics_Statistics_Rulesets_Ratio extends sspmod_statistics_Stat */ public function __construct($statconfig, $ruleconfig, $ruleid, $available) { - assert($statconfig instanceof SimpleSAML_Configuration); - assert($ruleconfig instanceof SimpleSAML_Configuration); + assert($statconfig instanceof \SimpleSAML\Configuration); + assert($ruleconfig instanceof \SimpleSAML\Configuration); parent::__construct($statconfig, $ruleconfig, $ruleid, $available); diff --git a/modules/statistics/www/showstats.php b/modules/statistics/www/showstats.php index b8bb32b68..efe2bf33d 100644 --- a/modules/statistics/www/showstats.php +++ b/modules/statistics/www/showstats.php @@ -1,7 +1,7 @@ <?php -$config = SimpleSAML_Configuration::getInstance(); -$statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php'); +$config = \SimpleSAML\Configuration::getInstance(); +$statconfig = \SimpleSAML\Configuration::getConfig('module_statistics.php'); $session = SimpleSAML_Session::getSessionFromRequest(); sspmod_statistics_AccessCheck::checkAccess($statconfig); diff --git a/modules/statistics/www/statmeta.php b/modules/statistics/www/statmeta.php index 91a5fe4aa..60c51db4c 100644 --- a/modules/statistics/www/statmeta.php +++ b/modules/statistics/www/statmeta.php @@ -1,7 +1,7 @@ <?php -$config = SimpleSAML_Configuration::getInstance(); -$statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php'); +$config = \SimpleSAML\Configuration::getInstance(); +$statconfig = \SimpleSAML\Configuration::getConfig('module_statistics.php'); sspmod_statistics_AccessCheck::checkAccess($statconfig); diff --git a/tests/Utils/ReduceSpillOverTest.php b/tests/Utils/ReduceSpillOverTest.php index 3c1022209..2f474576d 100644 --- a/tests/Utils/ReduceSpillOverTest.php +++ b/tests/Utils/ReduceSpillOverTest.php @@ -15,8 +15,8 @@ class ReduceSpillOverTest extends ClearStateTestCase public function testSetState() { $_SERVER['QUERY_STRING'] = 'a=b'; - \SimpleSAML_Configuration::loadFromArray(array('a' => 'b'), '[ARRAY]', 'simplesaml'); - $this->assertEquals('b', \SimpleSAML_Configuration::getInstance()->getString('a')); + \SimpleSAML\Configuration::loadFromArray(array('a' => 'b'), '[ARRAY]', 'simplesaml'); + $this->assertEquals('b', \SimpleSAML\Configuration::getInstance()->getString('a')); putenv('SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); } @@ -29,7 +29,7 @@ class ReduceSpillOverTest extends ClearStateTestCase $this->assertArrayNotHasKey('QUERY_STRING', $_SERVER); $this->assertFalse(getenv('SIMPLESAMLPHP_CONFIG_DIR')); try { - \SimpleSAML_Configuration::getInstance(); + \SimpleSAML\Configuration::getInstance(); $this->fail('Expected config configured in other tests to no longer be valid'); } catch (\SimpleSAML\Error\ConfigurationError $error) { // Expected error diff --git a/tests/Utils/StateClearer.php b/tests/Utils/StateClearer.php index 7d074d5b1..db32db8e7 100644 --- a/tests/Utils/StateClearer.php +++ b/tests/Utils/StateClearer.php @@ -1,4 +1,5 @@ <?php + namespace SimpleSAML\Test\Utils; /** @@ -17,7 +18,7 @@ class StateClearer * Class that implement \SimpleSAML\Utils\ClearableState and should have clearInternalState called between tests * @var array */ - private $clearableState = array('SimpleSAML_Configuration'); + private $clearableState = array('SimpleSAML\Configuration'); /** * Environmental variables to unset diff --git a/tests/lib/SimpleSAML/Auth/SimpleTest.php b/tests/lib/SimpleSAML/Auth/SimpleTest.php index 8bd5cf8fd..e0543b44b 100644 --- a/tests/lib/SimpleSAML/Auth/SimpleTest.php +++ b/tests/lib/SimpleSAML/Auth/SimpleTest.php @@ -8,7 +8,6 @@ namespace SimpleSAML\Test\Auth; */ class SimpleTest extends \SimpleSAML\Test\Utils\ClearStateTestCase { - /** * @test */ @@ -22,7 +21,7 @@ class SimpleTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $_SERVER['REQUEST_URI'] = '/'; // test merging configuration option with passed URL - \SimpleSAML_Configuration::loadFromArray(array( + \SimpleSAML\Configuration::loadFromArray(array( 'application' => array( 'baseURL' => 'https://example.org' ) @@ -50,7 +49,7 @@ class SimpleTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $this->assertEquals('https://example.org/foo/bar?a=b#fragment', $method->invokeArgs($s, array(null))); // test config option with ending with / and port - \SimpleSAML_Configuration::loadFromArray(array( + \SimpleSAML\Configuration::loadFromArray(array( 'application' => array( 'baseURL' => 'http://example.org:8080/' ) @@ -66,7 +65,7 @@ class SimpleTest extends \SimpleSAML\Test\Utils\ClearStateTestCase // now test with no configuration $_SERVER['SERVER_NAME'] = 'example.org'; - \SimpleSAML_Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); $s = new \SimpleSAML\Auth\Simple(''); $this->assertEquals('http://example.org:1234/foo/bar?a=b#fragment', $method->invokeArgs($s, array(null))); diff --git a/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php b/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php index 2666fb68b..782de37be 100644 --- a/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php +++ b/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php @@ -6,13 +6,12 @@ use SimpleSAML\Auth\TimeLimitedToken; class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase { - /** * Test for malformed tokens. */ public function testMalformedToken() { - \SimpleSAML_Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); $token = new TimeLimitedToken(); $this->assertFalse($token->validate('malformed')); @@ -26,7 +25,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase */ public function testValidToken() { - \SimpleSAML_Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); $token = new TimeLimitedToken(); $t = $token->generate(); @@ -39,7 +38,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase */ public function testValidTokenWithData() { - \SimpleSAML_Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); $tokenWithData = new TimeLimitedToken(); $tokenWithData->addVerificationData('some more random data'); @@ -56,7 +55,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase */ public function testExpiredToken() { - \SimpleSAML_Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); $token = new TimeLimitedToken(); $this->assertFalse($token->validate('7-c0803e76fff1df0ceb222dee80aa1d73f35d84dd')); @@ -68,7 +67,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase */ public function testManipulatedToken() { - \SimpleSAML_Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); $token = new TimeLimitedToken(1); $t = $token->generate(); diff --git a/tests/lib/SimpleSAML/ConfigurationTest.php b/tests/lib/SimpleSAML/ConfigurationTest.php index 14e3071a2..ea421b952 100644 --- a/tests/lib/SimpleSAML/ConfigurationTest.php +++ b/tests/lib/SimpleSAML/ConfigurationTest.php @@ -1,16 +1,18 @@ <?php +use \SimpleSAML\Configuration; + /** - * Tests for SimpleSAML_Configuration + * Tests for \SimpleSAML\Configuration */ -class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase +class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase { /** - * Test SimpleSAML_Configuration::getVersion() + * Test \SimpleSAML\Configuration::getVersion() */ public function testGetVersion() { - $c = SimpleSAML_Configuration::getOptionalConfig(); + $c = Configuration::getOptionalConfig(); $this->assertTrue(is_string($c->getVersion())); } @@ -20,8 +22,8 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest */ public function testLoadDefaultInstance() { - SimpleSAML_Configuration::loadFromArray(array('key' => 'value'), '', 'dummy'); - SimpleSAML_Configuration::getInstance(); + Configuration::loadFromArray(array('key' => 'value'), '', 'dummy'); + Configuration::getInstance(); } @@ -32,7 +34,7 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest public function testCriticalConfigurationError() { try { - SimpleSAML_Configuration::getInstance(); + Configuration::getInstance(); $this->fail('Exception expected'); } catch (\SimpleSAML\Error\CriticalConfigurationError $var) { // This exception is expected. @@ -41,16 +43,16 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest * After the above failure an emergency configuration is create to allow core SSP components to function and * possibly log/display the error. */ - $c = SimpleSAML_Configuration::getInstance(); + $c = Configuration::getInstance(); $this->assertNotEmpty($c->toArray()); } /** - * Test SimpleSAML_Configuration::getValue() + * Test \SimpleSAML\Configuration::getValue() */ public function testGetValue() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'exists_true' => true, 'exists_null' => null, ]); @@ -65,21 +67,21 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getValue(), REQUIRED_OPTION flag. + * Test \SimpleSAML\Configuration::getValue(), REQUIRED_OPTION flag. * @expectedException Exception */ public function testGetValueRequired() { - $c = SimpleSAML_Configuration::loadFromArray(array()); - $c->getValue('missing', SimpleSAML_Configuration::REQUIRED_OPTION); + $c = Configuration::loadFromArray(array()); + $c->getValue('missing', Configuration::REQUIRED_OPTION); } /** - * Test SimpleSAML_Configuration::hasValue() + * Test \SimpleSAML\Configuration::hasValue() */ public function testHasValue() { - $c = SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'exists_true' => true, 'exists_null' => null, )); @@ -89,11 +91,11 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::hasValue() + * Test \SimpleSAML\Configuration::hasValue() */ public function testHasValueOneOf() { - $c = SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'exists_true' => true, 'exists_null' => null, )); @@ -108,109 +110,109 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getBaseURL() + * Test \SimpleSAML\Configuration::getBaseURL() */ public function testGetBaseURL() { // Need to set a default configuration because the SSP Logger attempts to use it. - SimpleSAML_Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); - $c = SimpleSAML_Configuration::loadFromArray(array()); + Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + $c = Configuration::loadFromArray(array()); $this->assertEquals($c->getBaseURL(), 'simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'simplesaml/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'simplesaml/')); $this->assertEquals($c->getBaseURL(), 'simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '/simplesaml/')); + $c = Configuration::loadFromArray(array('baseurlpath' => '/simplesaml/')); $this->assertEquals($c->getBaseURL(), 'simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'path/to/simplesaml/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'path/to/simplesaml/')); $this->assertEquals($c->getBaseURL(), 'path/to/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '/path/to/simplesaml/')); + $c = Configuration::loadFromArray(array('baseurlpath' => '/path/to/simplesaml/')); $this->assertEquals($c->getBaseURL(), 'path/to/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/ssp/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/ssp/')); $this->assertEquals($c->getBaseURL(), 'ssp/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/')); $this->assertEquals($c->getBaseURL(), ''); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/')); $this->assertEquals($c->getBaseURL(), 'ssp/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '')); + $c = Configuration::loadFromArray(array('baseurlpath' => '')); $this->assertEquals($c->getBaseURL(), ''); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '/')); + $c = Configuration::loadFromArray(array('baseurlpath' => '/')); $this->assertEquals($c->getBaseURL(), ''); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'simplesaml')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'simplesaml')); $this->assertEquals($c->getBaseURL(), 'simplesaml/'); } /** - * Test SimpleSAML_Configuration::getBasePath() + * Test \SimpleSAML\Configuration::getBasePath() */ public function testGetBasePath() { - $c = SimpleSAML_Configuration::loadFromArray(array()); + $c = Configuration::loadFromArray(array()); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'simplesaml/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'simplesaml/')); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '/simplesaml/')); + $c = Configuration::loadFromArray(array('baseurlpath' => '/simplesaml/')); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'simplesaml')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'simplesaml')); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '/simplesaml')); + $c = Configuration::loadFromArray(array('baseurlpath' => '/simplesaml')); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'path/to/simplesaml/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'path/to/simplesaml/')); $this->assertEquals($c->getBasePath(), '/path/to/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '/path/to/simplesaml/')); + $c = Configuration::loadFromArray(array('baseurlpath' => '/path/to/simplesaml/')); $this->assertEquals($c->getBasePath(), '/path/to/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '/path/to/simplesaml')); + $c = Configuration::loadFromArray(array('baseurlpath' => '/path/to/simplesaml')); $this->assertEquals($c->getBasePath(), '/path/to/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/ssp/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/ssp/')); $this->assertEquals($c->getBasePath(), '/ssp/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/')); $this->assertEquals($c->getBasePath(), '/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/')); $this->assertEquals($c->getBasePath(), '/ssp/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/simplesaml')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/simplesaml')); $this->assertEquals($c->getBasePath(), '/ssp/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/simplesaml/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/simplesaml/')); $this->assertEquals($c->getBasePath(), '/ssp/simplesaml/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '')); + $c = Configuration::loadFromArray(array('baseurlpath' => '')); $this->assertEquals($c->getBasePath(), '/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => '/')); + $c = Configuration::loadFromArray(array('baseurlpath' => '/')); $this->assertEquals($c->getBasePath(), '/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'https://example.org:8443')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org:8443')); $this->assertEquals($c->getBasePath(), '/'); - $c = SimpleSAML_Configuration::loadFromArray(array('baseurlpath' => 'https://example.org:8443/')); + $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org:8443/')); $this->assertEquals($c->getBasePath(), '/'); } /** - * Test SimpleSAML_Configuration::resolvePath() + * Test \SimpleSAML\Configuration::resolvePath() */ public function testResolvePath() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'basedir' => '/basedir/', ]); @@ -226,11 +228,11 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getPathValue() + * Test \SimpleSAML\Configuration::getPathValue() */ public function testGetPathValue() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'basedir' => '/basedir/', 'path_opt' => 'path', 'slashes_opt' => 'slashes//', @@ -242,30 +244,30 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getBaseDir() + * Test \SimpleSAML\Configuration::getBaseDir() */ public function testGetBaseDir() { - $c = SimpleSAML_Configuration::loadFromArray([]); + $c = Configuration::loadFromArray([]); $this->assertEquals($c->getBaseDir(), dirname(dirname(dirname(dirname(__FILE__)))) . '/'); - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'basedir' => '/basedir', ]); $this->assertEquals($c->getBaseDir(), '/basedir/'); - $c = SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'basedir' => '/basedir/', )); $this->assertEquals($c->getBaseDir(), '/basedir/'); } /** - * Test SimpleSAML_Configuration::getBoolean() + * Test \SimpleSAML\Configuration::getBoolean() */ public function testGetBoolean() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'true_opt' => true, 'false_opt' => false, ]); @@ -275,33 +277,33 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getBoolean() missing option + * Test \SimpleSAML\Configuration::getBoolean() missing option * @expectedException Exception */ public function testGetBooleanMissing() { - $c = SimpleSAML_Configuration::loadFromArray([]); + $c = Configuration::loadFromArray([]); $c->getBoolean('missing_opt'); } /** - * Test SimpleSAML_Configuration::getBoolean() wrong option + * Test \SimpleSAML\Configuration::getBoolean() wrong option * @expectedException Exception */ public function testGetBooleanWrong() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'wrong' => 'true', ]); $c->getBoolean('wrong'); } /** - * Test SimpleSAML_Configuration::getString() + * Test \SimpleSAML\Configuration::getString() */ public function testGetString() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'str_opt' => 'Hello World!', ]); $this->assertEquals($c->getString('missing_opt', '--missing--'), '--missing--'); @@ -309,33 +311,33 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getString() missing option + * Test \SimpleSAML\Configuration::getString() missing option * @expectedException Exception */ public function testGetStringMissing() { - $c = SimpleSAML_Configuration::loadFromArray([]); + $c = Configuration::loadFromArray([]); $c->getString('missing_opt'); } /** - * Test SimpleSAML_Configuration::getString() wrong option + * Test \SimpleSAML\Configuration::getString() wrong option * @expectedException Exception */ public function testGetStringWrong() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'wrong' => false, ]); $c->getString('wrong'); } /** - * Test SimpleSAML_Configuration::getInteger() + * Test \SimpleSAML\Configuration::getInteger() */ public function testGetInteger() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'int_opt' => 42, ]); $this->assertEquals($c->getInteger('missing_opt', '--missing--'), '--missing--'); @@ -343,33 +345,33 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getInteger() missing option + * Test \SimpleSAML\Configuration::getInteger() missing option * @expectedException Exception */ public function testGetIntegerMissing() { - $c = SimpleSAML_Configuration::loadFromArray([]); + $c = Configuration::loadFromArray([]); $c->getInteger('missing_opt'); } /** - * Test SimpleSAML_Configuration::getInteger() wrong option + * Test \SimpleSAML\Configuration::getInteger() wrong option * @expectedException Exception */ public function testGetIntegerWrong() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'wrong' => '42', ]); $c->getInteger('wrong'); } /** - * Test SimpleSAML_Configuration::getIntegerRange() + * Test \SimpleSAML\Configuration::getIntegerRange() */ public function testGetIntegerRange() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'int_opt' => 42, ]); $this->assertEquals($c->getIntegerRange('missing_opt', 0, 100, '--missing--'), '--missing--'); @@ -377,34 +379,34 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getIntegerRange() below limit + * Test \SimpleSAML\Configuration::getIntegerRange() below limit * @expectedException Exception */ public function testGetIntegerRangeBelow() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'int_opt' => 9, ]); $this->assertEquals($c->getIntegerRange('int_opt', 10, 100), 42); } /** - * Test SimpleSAML_Configuration::getIntegerRange() above limit + * Test \SimpleSAML\Configuration::getIntegerRange() above limit * @expectedException Exception */ public function testGetIntegerRangeAbove() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'int_opt' => 101, ]); $this->assertEquals($c->getIntegerRange('int_opt', 10, 100), 42); } /** - * Test SimpleSAML_Configuration::getValueValidate() + * Test \SimpleSAML\Configuration::getValueValidate() */ public function testGetValueValidate() { - $c = SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'opt' => 'b', )); $this->assertEquals($c->getValueValidate('missing_opt', array('a', 'b', 'c'), '--missing--'), '--missing--'); @@ -412,23 +414,23 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getValueValidate() wrong option + * Test \SimpleSAML\Configuration::getValueValidate() wrong option * @expectedException Exception */ public function testGetValueValidateWrong() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => 'd', ]); $c->getValueValidate('opt', array('a', 'b', 'c')); } /** - * Test SimpleSAML_Configuration::getArray() + * Test \SimpleSAML\Configuration::getArray() */ public function testGetArray() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => array('a', 'b', 'c'), ]); $this->assertEquals($c->getArray('missing_opt', '--missing--'), '--missing--'); @@ -436,23 +438,23 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getArray() wrong option + * Test \SimpleSAML\Configuration::getArray() wrong option * @expectedException Exception */ public function testGetArrayWrong() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => 'not_an_array', ]); $c->getArray('opt'); } /** - * Test SimpleSAML_Configuration::getArrayize() + * Test \SimpleSAML\Configuration::getArrayize() */ public function testGetArrayize() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => array('a', 'b', 'c'), 'opt_int' => 42, 'opt_str' => 'string', @@ -464,11 +466,11 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getArrayizeString() + * Test \SimpleSAML\Configuration::getArrayizeString() */ public function testGetArrayizeString() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => array('a', 'b', 'c'), 'opt_str' => 'string', ]); @@ -478,49 +480,49 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getArrayizeString() option with an array that contains something that isn't a string. + * Test \SimpleSAML\Configuration::getArrayizeString() option with an array that contains something that isn't a string. * @expectedException Exception */ public function testGetArrayizeStringWrongValue() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => array('a', 'b', 42), ]); $c->getArrayizeString('opt'); } /** - * Test SimpleSAML_Configuration::getConfigItem() + * Test \SimpleSAML\Configuration::getConfigItem() */ public function testGetConfigItem() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => array('a' => 42), ]); $this->assertEquals($c->getConfigItem('missing_opt', '--missing--'), '--missing--'); $opt = $c->getConfigItem('opt'); - $this->assertInstanceOf('SimpleSAML_Configuration', $opt); + $this->assertInstanceOf('SimpleSAML\Configuration', $opt); $this->assertEquals($opt->getValue('a'), 42); } /** - * Test SimpleSAML_Configuration::getConfigItem() wrong option + * Test \SimpleSAML\Configuration::getConfigItem() wrong option * @expectedException Exception */ public function testGetConfigItemWrong() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => 'not_an_array', ]); $c->getConfigItem('opt'); } /** - * Test SimpleSAML_Configuration::getConfigList() + * Test \SimpleSAML\Configuration::getConfigList() */ public function testGetConfigList() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opts' => array( 'a' => array('opt1' => 'value1'), 'b' => array('opt2' => 'value2'), @@ -530,19 +532,19 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest $opts = $c->getConfigList('opts'); $this->assertInternalType('array', $opts); $this->assertEquals(array_keys($opts), array('a', 'b')); - $this->assertInstanceOf('SimpleSAML_Configuration', $opts['a']); + $this->assertInstanceOf('SimpleSAML\Configuration', $opts['a']); $this->assertEquals($opts['a']->getValue('opt1'), 'value1'); - $this->assertInstanceOf('SimpleSAML_Configuration', $opts['b']); + $this->assertInstanceOf('SimpleSAML\Configuration', $opts['b']); $this->assertEquals($opts['b']->getValue('opt2'), 'value2'); } /** - * Test SimpleSAML_Configuration::getConfigList() wrong option + * Test \SimpleSAML\Configuration::getConfigList() wrong option * @expectedException Exception */ public function testGetConfigListWrong() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => 'not_an_array', ]); $c->getConfigList('opt'); @@ -550,12 +552,12 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest /** - * Test SimpleSAML_Configuration::getConfigList() with an array of wrong options. + * Test \SimpleSAML\Configuration::getConfigList() with an array of wrong options. * @expectedException Exception */ public function testGetConfigListWrongArrayValues() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opts' => array( 'a', 'b', @@ -566,11 +568,11 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest /** - * Test SimpleSAML_Configuration::getOptions() + * Test \SimpleSAML\Configuration::getOptions() */ public function testGetOptions() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'a' => true, 'b' => null, ]); @@ -578,11 +580,11 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::toArray() + * Test \SimpleSAML\Configuration::toArray() */ public function testToArray() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'a' => true, 'b' => null, ]); @@ -591,7 +593,7 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest /** - * Test SimpleSAML_Configuration::getDefaultEndpoint(). + * Test \SimpleSAML\Configuration::getDefaultEndpoint(). * * Iterate over all different valid definitions of endpoints and check if the expected output is produced. */ @@ -732,7 +734,7 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest // run all general tests with AssertionConsumerService endpoint type foreach ($acs_eps as $i => $ep) { $a['AssertionConsumerService'] = $ep; - $c = SimpleSAML_Configuration::loadFromArray($a); + $c = Configuration::loadFromArray($a); $this->assertEquals($acs_expected_eps[$i], $c->getDefaultEndpoint( 'AssertionConsumerService', $valid_bindings @@ -741,7 +743,7 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest // now make sure SingleSignOnService, SingleLogoutService and ArtifactResolutionService works fine $a['metadata-set'] = 'shib13-idp-remote'; - $c = SimpleSAML_Configuration::loadFromArray($a); + $c = Configuration::loadFromArray($a); $this->assertEquals( array( 'Location' => 'https://example.com/sso', @@ -750,7 +752,7 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest $c->getDefaultEndpoint('SingleSignOnService') ); $a['metadata-set'] = 'saml20-idp-remote'; - $c = SimpleSAML_Configuration::loadFromArray($a); + $c = Configuration::loadFromArray($a); $this->assertEquals( array( 'Location' => 'https://example.com/ars', @@ -769,7 +771,7 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest // test for old shib1.3 AssertionConsumerService $a['metadata-set'] = 'shib13-sp-remote'; $a['AssertionConsumerService'] = 'https://example.com/endpoint.php'; - $c = SimpleSAML_Configuration::loadFromArray($a); + $c = Configuration::loadFromArray($a); $this->assertEquals( array( 'Location' => 'https://example.com/endpoint.php', @@ -786,7 +788,7 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest 'isDefault' => true, ), ); - $c = SimpleSAML_Configuration::loadFromArray($a); + $c = Configuration::loadFromArray($a); try { $c->getDefaultEndpoint('SingleLogoutService', $valid_bindings); $this->fail('Failed to detect invalid endpoint binding.'); @@ -797,7 +799,7 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest ); } $a['metadata-set'] = 'foo'; - $c = SimpleSAML_Configuration::loadFromArray($a); + $c = Configuration::loadFromArray($a); try { $c->getDefaultEndpoint('SingleSignOnService'); $this->fail('No valid metadata set specified.'); @@ -808,12 +810,12 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest /** - * Test SimpleSAML_Configuration::getEndpoints(). + * Test \SimpleSAML\Configuration::getEndpoints(). */ public function testGetEndpoints() { // test response location for old-style configurations - $c = SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'metadata-set' => 'saml20-idp-remote', 'SingleSignOnService' => 'https://example.com/endpoint.php', 'SingleSignOnServiceResponse' => 'https://example.com/response.php', @@ -901,7 +903,7 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest // now run all the tests expecting the correct exception message foreach ($tests as $i => $test) { $a['SingleSignOnService'] = $test; - $c = SimpleSAML_Configuration::loadFromArray($a); + $c = Configuration::loadFromArray($a); try { $c->getEndpoints('SingleSignOnService'); } catch (Exception $e) { @@ -912,11 +914,11 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest /** - * Test SimpleSAML_Configuration::getLocalizedString() + * Test \SimpleSAML\Configuration::getLocalizedString() */ public function testGetLocalizedString() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'str_opt' => 'Hello World!', 'str_array' => array( 'en' => 'Hello World!', @@ -929,61 +931,61 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest } /** - * Test SimpleSAML_Configuration::getLocalizedString() not array nor simple string + * Test \SimpleSAML\Configuration::getLocalizedString() not array nor simple string * @expectedException Exception */ public function testGetLocalizedStringNotArray() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => 42, ]); $c->getLocalizedString('opt'); } /** - * Test SimpleSAML_Configuration::getLocalizedString() not string key + * Test \SimpleSAML\Configuration::getLocalizedString() not string key * @expectedException Exception */ public function testGetLocalizedStringNotStringKey() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => array(42 => 'text'), ]); $c->getLocalizedString('opt'); } /** - * Test SimpleSAML_Configuration::getLocalizedString() not string value + * Test \SimpleSAML\Configuration::getLocalizedString() not string value * @expectedException Exception */ public function testGetLocalizedStringNotStringValue() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'opt' => array('en' => 42), ]); $c->getLocalizedString('opt'); } /** - * Test SimpleSAML_Configuration::getConfig() nonexistent file + * Test \SimpleSAML\Configuration::getConfig() nonexistent file * @expectedException Exception */ public function testGetConfigNonexistentFile() { - SimpleSAML_Configuration::getConfig('nonexistent-nopreload.php'); + Configuration::getConfig('nonexistent-nopreload.php'); } /** - * Test SimpleSAML_Configuration::getConfig() preloaded nonexistent file + * Test \SimpleSAML\Configuration::getConfig() preloaded nonexistent file */ public function testGetConfigNonexistentFilePreload() { - $c = SimpleSAML_Configuration::loadFromArray([ + $c = Configuration::loadFromArray([ 'key' => 'value' ]); $virtualFile = 'nonexistent-preload.php'; - SimpleSAML_Configuration::setPreLoadedConfig($c, $virtualFile); - $nc = SimpleSAML_Configuration::getConfig($virtualFile); + Configuration::setPreLoadedConfig($c, $virtualFile); + $nc = Configuration::getConfig($virtualFile); $this->assertEquals('value', $nc->getValue('key', null)); } @@ -998,11 +1000,11 @@ class Test_SimpleSAML_Configuration extends SimpleSAML\Test\Utils\ClearStateTest 'key' => 'value' ); // test loading a custom instance - SimpleSAML_Configuration::loadFromArray($c, '', 'dummy'); - $this->assertEquals('value', SimpleSAML_Configuration::getInstance('dummy')->getValue('key', null)); + Configuration::loadFromArray($c, '', 'dummy'); + $this->assertEquals('value', Configuration::getInstance('dummy')->getValue('key', null)); // test loading the default instance - SimpleSAML_Configuration::loadFromArray($c, '', 'simplesaml'); - $this->assertEquals('value', SimpleSAML_Configuration::getInstance()->getValue('key', null)); + Configuration::loadFromArray($c, '', 'simplesaml'); + $this->assertEquals('value', Configuration::getInstance()->getValue('key', null)); } } diff --git a/tests/lib/SimpleSAML/DatabaseTest.php b/tests/lib/SimpleSAML/DatabaseTest.php index 5f04dd87b..dea2ec26c 100644 --- a/tests/lib/SimpleSAML/DatabaseTest.php +++ b/tests/lib/SimpleSAML/DatabaseTest.php @@ -17,12 +17,12 @@ class SimpleSAML_DatabaseTest extends TestCase { /** - * @var SimpleSAML_Configuration + * @var \SimpleSAML\Configuration */ protected $config; /** - * @var SimpleSAML\Database + * @var \SimpleSAML\Database */ protected $db; @@ -59,10 +59,10 @@ class SimpleSAML_DatabaseTest extends TestCase 'database.slaves' => array(), ); - $this->config = new SimpleSAML_Configuration($config, "test/SimpleSAML/DatabaseTest.php"); + $this->config = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); // Ensure that we have a functional configuration class - $this->assertInstanceOf('SimpleSAML_Configuration', $this->config); + $this->assertInstanceOf('SimpleSAML\Configuration', $this->config); $this->assertEquals($config['database.dsn'], $this->config->getString('database.dsn')); $this->db = SimpleSAML\Database::getInstance($this->config); @@ -91,7 +91,7 @@ class SimpleSAML_DatabaseTest extends TestCase 'database.slaves' => array(), ); - $this->config = new SimpleSAML_Configuration($config, "test/SimpleSAML/DatabaseTest.php"); + $this->config = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); $db = SimpleSAML\Database::getInstance($this->config); } @@ -122,13 +122,13 @@ class SimpleSAML_DatabaseTest extends TestCase 'database.slaves' => array(), ); - $config1 = new SimpleSAML_Configuration($config, "test/SimpleSAML/DatabaseTest.php"); - $config2 = new SimpleSAML_Configuration($config2, "test/SimpleSAML/DatabaseTest.php"); - $config3 = new SimpleSAML_Configuration($config, "test/SimpleSAML/DatabaseTest.php"); + $config1 = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); + $config2 = new \SimpleSAML\Configuration($config2, "test/SimpleSAML/DatabaseTest.php"); + $config3 = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); - $db1 = SimpleSAML\Database::getInstance($config1); - $db2 = SimpleSAML\Database::getInstance($config2); - $db3 = SimpleSAML\Database::getInstance($config3); + $db1 = \SimpleSAML\Database::getInstance($config1); + $db2 = \SimpleSAML\Database::getInstance($config2); + $db3 = \SimpleSAML\Database::getInstance($config3); $generateInstanceId = self::getMethod('generateInstanceId'); @@ -196,8 +196,8 @@ class SimpleSAML_DatabaseTest extends TestCase ), ); - $sspConfiguration = new SimpleSAML_Configuration($config, "test/SimpleSAML/DatabaseTest.php"); - $msdb = SimpleSAML\Database::getInstance($sspConfiguration); + $sspConfiguration = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); + $msdb = \SimpleSAML\Database::getInstance($sspConfiguration); $slaves = PHPUnit_Framework_Assert::readAttribute($msdb, 'dbSlaves'); $gotSlave = spl_object_hash($getSlave->invokeArgs($msdb, array())); diff --git a/tests/lib/SimpleSAML/Locale/LanguageTest.php b/tests/lib/SimpleSAML/Locale/LanguageTest.php index 4b76c09d6..09c53d760 100644 --- a/tests/lib/SimpleSAML/Locale/LanguageTest.php +++ b/tests/lib/SimpleSAML/Locale/LanguageTest.php @@ -3,24 +3,23 @@ namespace SimpleSAML\Test\Locale; use PHPUnit\Framework\TestCase; +use SimpleSAML\Configuration; use SimpleSAML\Locale\Language; class LanguageTest extends TestCase { - - /** * Test SimpleSAML\Locale\Language::getDefaultLanguage(). */ public function testGetDefaultLanguage() { // test default - $c = \SimpleSAML_Configuration::loadFromArray(array()); + $c = Configuration::loadFromArray(array()); $l = new Language($c); $this->assertEquals('en', $l->getDefaultLanguage()); // test defaults coming from configuration - $c = \SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'language.available' => array('en', 'es', 'nn'), 'language.default' => 'es', )); @@ -35,16 +34,16 @@ class LanguageTest extends TestCase public function testGetLanguageCookie() { // test it works when no cookie is set - \SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml'); + Configuration::loadFromArray(array(), '', 'simplesaml'); $this->assertNull(Language::getLanguageCookie()); // test that it works fine with defaults - \SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml'); + Configuration::loadFromArray(array(), '', 'simplesaml'); $_COOKIE['language'] = 'en'; $this->assertEquals('en', Language::getLanguageCookie()); // test that it works with non-defaults - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'language.available' => array('en', 'es', 'nn'), 'language.cookie.name' => 'xyz' ), '', 'simplesaml'); @@ -58,8 +57,8 @@ class LanguageTest extends TestCase */ public function testGetLanguageListNoConfig() { - // test defaults - $c = \SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml'); + // test default + $c = Configuration::loadFromArray(array(), '', 'simplesaml'); $l = new Language($c); $l->setLanguage('en'); $this->assertEquals(array('en' => true), $l->getLanguageList()); @@ -72,7 +71,7 @@ class LanguageTest extends TestCase public function testGetLanguageListCorrectConfig() { // test langs from from language_names - $c = \SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'language.available' => array('en', 'nn', 'es'), ), '', 'simplesaml'); $l = new Language($c); @@ -91,7 +90,7 @@ class LanguageTest extends TestCase public function testGetLanguageListIncorrectConfig() { // test non-existent langs - $c = \SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'language.available' => array('foo', 'bar'), ), '', 'simplesaml'); $l = new Language($c); @@ -106,12 +105,12 @@ class LanguageTest extends TestCase public function testGetLanguageParameterName() { // test for default configuration - $c = \SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml'); + $c = Configuration::loadFromArray(array(), '', 'simplesaml'); $l = new Language($c); $this->assertEquals('language', $l->getLanguageParameterName()); // test for valid configuration - $c = \SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'language.parameter.name' => 'xyz' ), '', 'simplesaml'); $l = new Language($c); @@ -125,13 +124,13 @@ class LanguageTest extends TestCase public function testIsLanguageRTL() { // test defaults - $c = \SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml'); + $c = Configuration::loadFromArray(array(), '', 'simplesaml'); $l = new Language($c); $l->setLanguage('en'); $this->assertFalse($l->isLanguageRTL()); // test non-defaults, non-RTL - $c = \SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'language.rtl' => array('foo', 'bar'), ), '', 'simplesaml'); $l = new Language($c); @@ -139,7 +138,7 @@ class LanguageTest extends TestCase $this->assertFalse($l->isLanguageRTL()); // test non-defaults, RTL - $c = \SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'language.available' => array('en', 'nn', 'es'), 'language.rtl' => array('nn', 'es'), ), '', 'simplesaml'); @@ -155,7 +154,7 @@ class LanguageTest extends TestCase public function testSetLanguage() { // test with valid configuration, no cookies set - $c = \SimpleSAML_Configuration::loadFromArray(array( + $c = Configuration::loadFromArray(array( 'language.available' => array('en', 'nn', 'es'), 'language.parameter.name' => 'xyz', 'language.parameter.setcookie' => false, diff --git a/tests/lib/SimpleSAML/Locale/LocalizationTest.php b/tests/lib/SimpleSAML/Locale/LocalizationTest.php index d38af4add..c45eb0974 100644 --- a/tests/lib/SimpleSAML/Locale/LocalizationTest.php +++ b/tests/lib/SimpleSAML/Locale/LocalizationTest.php @@ -4,8 +4,7 @@ namespace SimpleSAML\Test\Locale; use PHPUnit\Framework\TestCase; use SimpleSAML\Locale\Localization; -use \SimpleSAML_Configuration as Configuration; - +use \SimpleSAML\Configuration; class LocalizationTest extends TestCase { @@ -22,7 +21,7 @@ class LocalizationTest extends TestCase public function testLocalization() { // The constructor should activate the default domain - $c = \SimpleSAML_Configuration::loadFromArray( + $c = Configuration::loadFromArray( array('language.i18n.backend' => 'SimpleSAMLphp') ); $l = new Localization($c); @@ -35,7 +34,7 @@ class LocalizationTest extends TestCase */ public function testAddDomain() { - $c = \SimpleSAML_Configuration::loadFromArray( + $c = Configuration::loadFromArray( array('language.i18n.backend' => 'gettext/gettext') ); $l = new Localization($c); diff --git a/tests/lib/SimpleSAML/Locale/TranslateTest.php b/tests/lib/SimpleSAML/Locale/TranslateTest.php index 93d6c441b..48d92377d 100644 --- a/tests/lib/SimpleSAML/Locale/TranslateTest.php +++ b/tests/lib/SimpleSAML/Locale/TranslateTest.php @@ -14,7 +14,7 @@ class TranslateTest extends TestCase public function testNoop() { // test default - $c = \SimpleSAML_Configuration::loadFromArray(array()); + $c = \SimpleSAML\Configuration::loadFromArray(array()); $t = new Translate($c); $testString = 'Blablabla'; $this->assertEquals($testString, $t->noop($testString)); @@ -25,7 +25,7 @@ class TranslateTest extends TestCase */ public function testTFallback() { - $c = \SimpleSAML_Configuration::loadFromArray(array()); + $c = \SimpleSAML\Configuration::loadFromArray(array()); $t = new Translate($c); $testString = 'Blablabla'; diff --git a/tests/lib/SimpleSAML/ModuleTest.php b/tests/lib/SimpleSAML/ModuleTest.php index 00cff258c..bf5efbc7e 100644 --- a/tests/lib/SimpleSAML/ModuleTest.php +++ b/tests/lib/SimpleSAML/ModuleTest.php @@ -1,4 +1,5 @@ <?php + namespace SimpleSAML\Test; use PHPUnit\Framework\TestCase; @@ -6,8 +7,6 @@ use SimpleSAML\Module; class ModuleTest extends TestCase { - - /** * Test for SimpleSAML\Module::isModuleEnabled(). */ @@ -36,7 +35,7 @@ class ModuleTest extends TestCase */ public function testGetModuleURL() { - \SimpleSAML_Configuration::loadFromArray(array( + \SimpleSAML\Configuration::loadFromArray(array( 'baseurlpath' => 'https://example.com/simplesaml/' ), '', 'simplesaml'); $this->assertEquals( diff --git a/tests/lib/SimpleSAML/Store/RedisTest.php b/tests/lib/SimpleSAML/Store/RedisTest.php index d17f4473a..fbe770522 100644 --- a/tests/lib/SimpleSAML/Store/RedisTest.php +++ b/tests/lib/SimpleSAML/Store/RedisTest.php @@ -3,7 +3,7 @@ namespace SimpleSAML\Test\Store; use PHPUnit\Framework\TestCase; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\Store; /** @@ -84,7 +84,7 @@ class RedisTest extends TestCase $this->assertInstanceOf('SimpleSAML\Store\Redis', $store); - $this->clearInstance($config, '\SimpleSAML_Configuration'); + $this->clearInstance($config, '\SimpleSAML\Configuration'); $this->clearInstance($store, '\SimpleSAML\Store'); } diff --git a/tests/lib/SimpleSAML/Store/SQLTest.php b/tests/lib/SimpleSAML/Store/SQLTest.php index 66170ab19..1321726d3 100644 --- a/tests/lib/SimpleSAML/Store/SQLTest.php +++ b/tests/lib/SimpleSAML/Store/SQLTest.php @@ -3,7 +3,7 @@ namespace SimpleSAML\Test\Store; use PHPUnit\Framework\TestCase; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\Store; /** @@ -19,7 +19,7 @@ class SQLTest extends TestCase { protected function setUp() { - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'store.type' => 'sql', 'store.sql.dsn' => 'sqlite::memory:', 'store.sql.prefix' => 'phpunit_', @@ -176,7 +176,7 @@ class SQLTest extends TestCase $config = Configuration::getInstance(); $store = Store::getInstance(); - $this->clearInstance($config, '\SimpleSAML_Configuration'); + $this->clearInstance($config, '\SimpleSAML\Configuration'); $this->clearInstance($store, '\SimpleSAML\Store'); } diff --git a/tests/lib/SimpleSAML/StoreTest.php b/tests/lib/SimpleSAML/StoreTest.php index 22641681d..61f0fe823 100644 --- a/tests/lib/SimpleSAML/StoreTest.php +++ b/tests/lib/SimpleSAML/StoreTest.php @@ -3,7 +3,7 @@ namespace SimpleSAML\Test; use PHPUnit\Framework\TestCase; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\Store; /** @@ -121,7 +121,7 @@ class StoreTest extends TestCase $config = Configuration::getInstance(); $store = Store::getInstance(); - $this->clearInstance($config, '\SimpleSAML_Configuration'); + $this->clearInstance($config, '\SimpleSAML\Configuration'); $this->clearInstance($store, '\SimpleSAML\Store'); } diff --git a/tests/lib/SimpleSAML/Utils/CryptoTest.php b/tests/lib/SimpleSAML/Utils/CryptoTest.php index a47d0d432..32aa68292 100644 --- a/tests/lib/SimpleSAML/Utils/CryptoTest.php +++ b/tests/lib/SimpleSAML/Utils/CryptoTest.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Test\Utils; use PHPUnit\Framework\TestCase; use SimpleSAML\Utils\Crypto; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \org\bovigo\vfs\vfsStream; diff --git a/tests/lib/SimpleSAML/Utils/HTTPTest.php b/tests/lib/SimpleSAML/Utils/HTTPTest.php index d5708322b..b1a82effd 100644 --- a/tests/lib/SimpleSAML/Utils/HTTPTest.php +++ b/tests/lib/SimpleSAML/Utils/HTTPTest.php @@ -3,6 +3,7 @@ namespace SimpleSAML\Test\Utils; use PHPUnit\Framework\TestCase; use SimpleSAML\Utils\HTTP; +use SimpleSAML\Configuration; class HTTPTest extends TestCase { @@ -125,7 +126,7 @@ class HTTPTest extends TestCase { $original = $_SERVER; - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'baseurlpath' => '', ), '[ARRAY]', 'simplesaml'); $_SERVER['SERVER_PORT'] = '80'; @@ -143,7 +144,7 @@ class HTTPTest extends TestCase { $original = $_SERVER; - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'baseurlpath' => '', ), '[ARRAY]', 'simplesaml'); @@ -174,7 +175,7 @@ class HTTPTest extends TestCase * Test a URL pointing to a script that's not part of the public interface. This allows us to test calls to * getSelfURL() from scripts outside of SimpleSAMLphp */ - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'baseurlpath' => 'http://example.com/simplesaml/', ), '[ARRAY]', 'simplesaml'); $url = 'https://example.com/app/script.php/some/path?foo=bar'; @@ -187,7 +188,7 @@ class HTTPTest extends TestCase $this->assertEquals('https://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a request URI that doesn't match the current script - $cfg = \SimpleSAML_Configuration::loadFromArray(array( + $cfg = Configuration::loadFromArray(array( 'baseurlpath' => 'https://example.org/simplesaml/', ), '[ARRAY]', 'simplesaml'); $baseDir = $cfg->getBaseDir(); @@ -201,7 +202,7 @@ class HTTPTest extends TestCase $this->assertEquals('http://www.example.com', HTTP::getSelfURLHost()); // test a valid, full URL, based on a full URL in the configuration - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'baseurlpath' => 'https://example.com/simplesaml/', ), '[ARRAY]', 'simplesaml'); $this->setupEnvFromURL('http://www.example.org/module.php/module/file.php?foo=bar'); @@ -215,7 +216,7 @@ class HTTPTest extends TestCase $this->assertEquals('https://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a full URL *without* a trailing slash in the configuration - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'baseurlpath' => 'https://example.com/simplesaml', ), '[ARRAY]', 'simplesaml'); $this->assertEquals( @@ -228,7 +229,7 @@ class HTTPTest extends TestCase $this->assertEquals('https://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a full URL *without* a path in the configuration - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'baseurlpath' => 'https://example.com', ), '[ARRAY]', 'simplesaml'); $this->assertEquals( @@ -241,7 +242,7 @@ class HTTPTest extends TestCase $this->assertEquals('https://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a relative path in the configuration - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'baseurlpath' => '/simplesaml/', ), '[ARRAY]', 'simplesaml'); $this->setupEnvFromURL('http://www.example.org/simplesaml/module.php/module/file.php?foo=bar'); @@ -255,7 +256,7 @@ class HTTPTest extends TestCase $this->assertEquals('http://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a relative path in the configuration and a non standard port - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'baseurlpath' => '/simplesaml/', ), '[ARRAY]', 'simplesaml'); $this->setupEnvFromURL('http://example.org:8080/simplesaml/module.php/module/file.php?foo=bar'); @@ -269,7 +270,7 @@ class HTTPTest extends TestCase $this->assertEquals('http://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a relative path in the configuration, a non standard port and HTTPS - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'baseurlpath' => '/simplesaml/', ), '[ARRAY]', 'simplesaml'); $this->setupEnvFromURL('https://example.org:8080/simplesaml/module.php/module/file.php?foo=bar'); @@ -295,7 +296,7 @@ class HTTPTest extends TestCase { $original = $_SERVER; - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'trusted.url.domains' => array('sp.example.com', 'app.example.com'), 'trusted.url.regex' => false, ), '[ARRAY]', 'simplesaml'); @@ -325,7 +326,7 @@ class HTTPTest extends TestCase { $original = $_SERVER; - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'trusted.url.domains' => array('.*\.example\.com'), 'trusted.url.regex' => true, ), '[ARRAY]', 'simplesaml'); @@ -402,7 +403,7 @@ class HTTPTest extends TestCase { $original = $_SERVER; - \SimpleSAML_Configuration::loadFromArray(array( + Configuration::loadFromArray(array( 'trusted.url.domains' => array('app\.example\.com'), 'trusted.url.regex' => true, ), '[ARRAY]', 'simplesaml'); diff --git a/tests/lib/SimpleSAML/Utils/SystemTest.php b/tests/lib/SimpleSAML/Utils/SystemTest.php index 897f8a3d9..c075922eb 100644 --- a/tests/lib/SimpleSAML/Utils/SystemTest.php +++ b/tests/lib/SimpleSAML/Utils/SystemTest.php @@ -3,7 +3,7 @@ namespace SimpleSAML\Test\Utils; use PHPUnit\Framework\TestCase; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\Utils\System; use \org\bovigo\vfs\vfsStream; @@ -124,7 +124,7 @@ class SystemTest extends TestCase $this->assertFileExists($filename); - $this->clearInstance($config, '\SimpleSAML_Configuration'); + $this->clearInstance($config, '\SimpleSAML\Configuration'); } /** @@ -146,7 +146,7 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); - $this->clearInstance($config, '\SimpleSAML_Configuration'); + $this->clearInstance($config, '\SimpleSAML\Configuration'); } /** @@ -168,7 +168,7 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); - $this->clearInstance($config, '\SimpleSAML_Configuration'); + $this->clearInstance($config, '\SimpleSAML\Configuration'); } /** @@ -186,7 +186,7 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); $this->assertFileExists($res); - $this->clearInstance($config, '\SimpleSAML_Configuration'); + $this->clearInstance($config, '\SimpleSAML\Configuration'); } /** @@ -204,7 +204,7 @@ class SystemTest extends TestCase $this->assertEquals($expected, $res); $this->assertFileExists($res); - $this->clearInstance($config, '\SimpleSAML_Configuration'); + $this->clearInstance($config, '\SimpleSAML\Configuration'); } /** @@ -224,7 +224,7 @@ class SystemTest extends TestCase $this->setExpectedException('\SimpleSAML_Error_Exception'); $res = System::getTempDir(); - $this->clearInstance($config, '\SimpleSAML_Configuration'); + $this->clearInstance($config, '\SimpleSAML\Configuration'); } private function setConfigurationTempDir($directory) diff --git a/tests/lib/SimpleSAML/Utils/TimeTest.php b/tests/lib/SimpleSAML/Utils/TimeTest.php index 043aefbe5..16acc44ff 100644 --- a/tests/lib/SimpleSAML/Utils/TimeTest.php +++ b/tests/lib/SimpleSAML/Utils/TimeTest.php @@ -7,7 +7,6 @@ use SimpleSAML\Utils\Time; class TimeTest extends TestCase { - /** * Test the SimpleSAML\Utils\Time::generateTimestamp() method. * @@ -37,7 +36,7 @@ class TimeTest extends TestCase } // test guessing timezone from the OS - \SimpleSAML_Configuration::loadFromArray(array('timezone' => null), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array('timezone' => null), '[ARRAY]', 'simplesaml'); @Time::initTimezone(); $this->assertEquals($os, @date_default_timezone_get()); @@ -47,7 +46,7 @@ class TimeTest extends TestCase $c->setValue(false); // test unknown timezone - \SimpleSAML_Configuration::loadFromArray(array('timezone' => 'INVALID'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array('timezone' => 'INVALID'), '[ARRAY]', 'simplesaml'); try { @Time::initTimezone(); $this->fail('Failed to recognize an invalid timezone.'); @@ -56,12 +55,12 @@ class TimeTest extends TestCase } // test a valid timezone - \SimpleSAML_Configuration::loadFromArray(array('timezone' => $tz), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array('timezone' => $tz), '[ARRAY]', 'simplesaml'); @Time::initTimezone(); $this->assertEquals($tz, @date_default_timezone_get()); // make sure initialization happens only once - \SimpleSAML_Configuration::loadFromArray(array('timezone' => 'Europe/Madrid'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array('timezone' => 'Europe/Madrid'), '[ARRAY]', 'simplesaml'); @Time::initTimezone(); $this->assertEquals($tz, @date_default_timezone_get()); } diff --git a/tests/lib/SimpleSAML/Utils/XMLTest.php b/tests/lib/SimpleSAML/Utils/XMLTest.php index 766048795..adeb99739 100644 --- a/tests/lib/SimpleSAML/Utils/XMLTest.php +++ b/tests/lib/SimpleSAML/Utils/XMLTest.php @@ -3,7 +3,7 @@ namespace SimpleSAML\Test\Utils; use PHPUnit\Framework\TestCase; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\Utils\XML; /** @@ -357,7 +357,7 @@ NOWDOC; */ public function testIsValidMetadata() { - \SimpleSAML_Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); $schema = 'saml-schema-metadata-2.0.xsd'; diff --git a/tests/lib/SimpleSAML/XML/SignerTest.php b/tests/lib/SimpleSAML/XML/SignerTest.php index 77edff09d..65b0f81cc 100644 --- a/tests/lib/SimpleSAML/XML/SignerTest.php +++ b/tests/lib/SimpleSAML/XML/SignerTest.php @@ -3,7 +3,7 @@ namespace SimpleSAML\Test\Utils; use PHPUnit\Framework\TestCase; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\XML\Signer; use \org\bovigo\vfs\vfsStream; @@ -127,7 +127,7 @@ NOWDOC; public function tearDown() { - $this->clearInstance($this->config, '\SimpleSAML_Configuration', array()); + $this->clearInstance($this->config, '\SimpleSAML\Configuration', array()); } public function testSignerBasic() diff --git a/tests/lib/SimpleSAML/XML/ValidatorTest.php b/tests/lib/SimpleSAML/XML/ValidatorTest.php index 8dc2179f4..788788612 100644 --- a/tests/lib/SimpleSAML/XML/ValidatorTest.php +++ b/tests/lib/SimpleSAML/XML/ValidatorTest.php @@ -3,7 +3,7 @@ namespace SimpleSAML\Test\XML; use PHPUnit\Framework\TestCase; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; use \SimpleSAML\XML\Signer; use \SimpleSAML\XML\Validator; @@ -171,7 +171,7 @@ NOWDOC; public function tearDown() { - $this->clearInstance($this->config, '\SimpleSAML_Configuration', array()); + $this->clearInstance($this->config, '\SimpleSAML\Configuration', array()); } public function testValidatorMissingSignature() diff --git a/tests/modules/consent/lib/Auth/Process/ConsentTest.php b/tests/modules/consent/lib/Auth/Process/ConsentTest.php index c0c03cae5..e24b12c3f 100644 --- a/tests/modules/consent/lib/Auth/Process/ConsentTest.php +++ b/tests/modules/consent/lib/Auth/Process/ConsentTest.php @@ -9,7 +9,7 @@ namespace SimpleSAML\Test\Module\consent\Auth\Process; use PHPUnit\Framework\TestCase; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; class ConsentTest extends TestCase { diff --git a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php index 4939ec8b1..535932ba1 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php @@ -7,7 +7,6 @@ use PHPUnit\Framework\TestCase; */ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase { - /** * Helper function to run the filter with a given configuration. * @@ -345,7 +344,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public function testMatchAttributeValuesRegex() { // SSP Logger requires a configuration to be set. - SimpleSAML_Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); $state = self::$request; $state['Attributes']['eduPersonEntitlement'] = array( 'urn:mace:example.terena.org:tcs:personal-user', diff --git a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php index c3085154d..2affbaf5c 100644 --- a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php +++ b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php @@ -29,7 +29,7 @@ class Test_Core_Auth_Process_CardinalitySingleTest extends \PHPUnit_Framework_Te protected function setUp() { - \SimpleSAML_Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); $this->http = $this->getMockBuilder('SimpleSAML\Utils\HTTPAdapter') ->setMethods(array('redirectTrustedURL')) ->getMock(); diff --git a/tests/modules/core/lib/Auth/Process/CardinalityTest.php b/tests/modules/core/lib/Auth/Process/CardinalityTest.php index 5231fce8c..1548815c0 100644 --- a/tests/modules/core/lib/Auth/Process/CardinalityTest.php +++ b/tests/modules/core/lib/Auth/Process/CardinalityTest.php @@ -29,7 +29,7 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \SimpleSAML_Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); $this->http = $this->getMockBuilder('SimpleSAML\Utils\HTTPAdapter') ->setMethods(array('redirectTrustedURL')) ->getMock(); diff --git a/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php b/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php index c50700fd4..0b8c19d52 100644 --- a/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php +++ b/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php @@ -12,7 +12,7 @@ class Test_Core_Storage_SQLPermanentStorage extends TestCase public static function setUpBeforeClass() { // Create instance - $config = \SimpleSAML_Configuration::loadFromArray([ + $config = \SimpleSAML\Configuration::loadFromArray([ 'datadir' => sys_get_temp_dir(), ]); self::$sql = new sspmod_core_Storage_SQLPermanentStorage('test', $config); diff --git a/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php b/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php index 57baff5ff..d18974b23 100644 --- a/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php +++ b/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php @@ -3,7 +3,7 @@ namespace SimpleSAML\Test\Module\saml\Auth\Source; use PHPUnit\Framework\TestCase; -use \SimpleSAML_Configuration as Configuration; +use \SimpleSAML\Configuration; /** * Custom Exception to throw to terminate a TestCase. @@ -41,7 +41,7 @@ class SP_Tester extends \sspmod_saml_Auth_Source_SP } - public function startSSO2Test(\SimpleSAML_Configuration $idpMetadata, array $state) + public function startSSO2Test(Configuration $idpMetadata, array $state) { $reflector = new \ReflectionObject($this); $method = $reflector->getMethod('startSSO2'); @@ -79,7 +79,7 @@ class SP_Test extends TestCase private function getIdpMetadata() { if (!$this->idpMetadata) { - $this->idpMetadata = new \SimpleSAML_Configuration( + $this->idpMetadata = new Configuration( $this->idpConfigArray, 'Auth_Source_SP_Test::getIdpMetadata()' ); diff --git a/tests/routers/configLoader.php b/tests/routers/configLoader.php index 724cada28..57baa0a42 100644 --- a/tests/routers/configLoader.php +++ b/tests/routers/configLoader.php @@ -33,7 +33,7 @@ require_once(dirname(__FILE__).'/../../vendor/autoload.php'); // initialize configuration if (isset($config)) { - SimpleSAML_Configuration::loadFromArray($config, '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray($config, '[ARRAY]', 'simplesaml'); } // let the script proceed diff --git a/www/_include.php b/www/_include.php index 7c18a2525..0f12ef741 100644 --- a/www/_include.php +++ b/www/_include.php @@ -65,7 +65,7 @@ function SimpleSAML_error_handler($errno, $errstr, $errfile = null, $errline = 0 set_error_handler('SimpleSAML_error_handler'); try { - SimpleSAML_Configuration::getInstance(); + \SimpleSAML\Configuration::getInstance(); } catch (Exception $e) { throw new \SimpleSAML\Error\CriticalConfigurationError( $e->getMessage() diff --git a/www/admin/hostnames.php b/www/admin/hostnames.php index 90d58c386..216e57cb5 100644 --- a/www/admin/hostnames.php +++ b/www/admin/hostnames.php @@ -2,8 +2,8 @@ require_once('../_include.php'); -// Load SimpleSAMLphp, configuration -$config = SimpleSAML_Configuration::getInstance(); +// Load SimpleSAMLphp configuration +$config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); // Check if valid local session exists.. diff --git a/www/admin/index.php b/www/admin/index.php index 65dc1e5dc..9a78941a4 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -2,8 +2,8 @@ require_once('../_include.php'); -// Load SimpleSAMLphp, configuration -$config = SimpleSAML_Configuration::getInstance(); +// Load SimpleSAMLphp configuration +$config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); // Check if valid local session exists.. diff --git a/www/admin/metadata-converter.php b/www/admin/metadata-converter.php index 52313f1b7..9b6072580 100644 --- a/www/admin/metadata-converter.php +++ b/www/admin/metadata-converter.php @@ -4,7 +4,7 @@ require_once('../_include.php'); // make sure that the user has admin access rights SimpleSAML\Utils\Auth::requireAdmin(); -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); if (!empty($_FILES['xmlfile']['tmp_name'])) { $xmldata = trim(file_get_contents($_FILES['xmlfile']['tmp_name'])); diff --git a/www/admin/sandbox.php b/www/admin/sandbox.php index ec77569cf..f6bcb66ba 100644 --- a/www/admin/sandbox.php +++ b/www/admin/sandbox.php @@ -2,8 +2,8 @@ require_once('../_include.php'); -// Load SimpleSAMLphp, configuration -$config = SimpleSAML_Configuration::getInstance(); +// Load SimpleSAMLphp configuration +$config = \SimpleSAML\Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); // Check if valid local session exists.. diff --git a/www/authmemcookie.php b/www/authmemcookie.php index d403aee13..c385b16a5 100644 --- a/www/authmemcookie.php +++ b/www/authmemcookie.php @@ -16,7 +16,7 @@ require_once('_include.php'); try { // load SimpleSAMLphp configuration - $globalConfig = SimpleSAML_Configuration::getInstance(); + $globalConfig = \SimpleSAML\Configuration::getInstance(); // check if this module is enabled if (!$globalConfig->getBoolean('enable.authmemcookie', false)) { diff --git a/www/errorreport.php b/www/errorreport.php index 569db4199..ae2bea150 100644 --- a/www/errorreport.php +++ b/www/errorreport.php @@ -2,7 +2,7 @@ require_once('_include.php'); -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); // this page will redirect to itself after processing a POST request and sending the email if ($_SERVER['REQUEST_METHOD'] !== 'POST') { diff --git a/www/logout.php b/www/logout.php index b87ca89b7..97d4a7fec 100644 --- a/www/logout.php +++ b/www/logout.php @@ -2,7 +2,7 @@ require_once('_include.php'); -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); if (array_key_exists('link_href', $_REQUEST)) { $link = \SimpleSAML\Utils\HTTP::checkURLAllowed($_REQUEST['link_href']); diff --git a/www/saml2/idp/ArtifactResolutionService.php b/www/saml2/idp/ArtifactResolutionService.php index 39f705e65..287dff319 100644 --- a/www/saml2/idp/ArtifactResolutionService.php +++ b/www/saml2/idp/ArtifactResolutionService.php @@ -10,7 +10,7 @@ require_once('../../_include.php'); -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); if (!$config->getBoolean('enable.saml20-idp', false)) { throw new SimpleSAML_Error_Error('NOACCESS'); } diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php index 8149c9552..f1dd5680b 100644 --- a/www/saml2/idp/metadata.php +++ b/www/saml2/idp/metadata.php @@ -9,7 +9,7 @@ use SimpleSAML\Utils\HTTP as HTTP; use SimpleSAML\Utils\Config\Metadata as Metadata; // load SimpleSAMLphp, configuration and metadata -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); if (!$config->getBoolean('enable.saml20-idp', false)) { diff --git a/www/shib13/idp/metadata.php b/www/shib13/idp/metadata.php index 23c3f6857..b8579fa8f 100644 --- a/www/shib13/idp/metadata.php +++ b/www/shib13/idp/metadata.php @@ -3,7 +3,7 @@ require_once('../../_include.php'); // load configuration and metadata -$config = SimpleSAML_Configuration::getInstance(); +$config = \SimpleSAML\Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); if (!$config->getBoolean('enable.shib13-idp', false)) { -- GitLab