From d71c793ef866c8f37288c2a51bc2571c551a67d5 Mon Sep 17 00:00:00 2001 From: Jaime Perez Crespo <jaime.perez@uninett.no> Date: Mon, 20 Apr 2015 16:05:14 +0200 Subject: [PATCH] Move SimpleSAML_Utils_Config to SimpleSAML\Utils\Config. --- lib/SimpleSAML/Auth/TimeLimitedToken.php | 2 +- lib/SimpleSAML/Utilities.php | 4 ++-- lib/SimpleSAML/Utils/Config.php | 12 ++++++------ lib/SimpleSAML/Utils/Crypto.php | 4 ++-- lib/SimpleSAML/Utils/Random.php | 5 ++--- modules/consent/lib/Auth/Process/Consent.php | 4 ++-- modules/consent/lib/Consent/Store/Cookie.php | 2 +- modules/core/lib/Auth/Process/TargetedID.php | 2 +- modules/saml/lib/Auth/Process/PersistentNameID.php | 2 +- modules/saml/lib/IdP/SAML2.php | 2 +- 10 files changed, 19 insertions(+), 20 deletions(-) diff --git a/lib/SimpleSAML/Auth/TimeLimitedToken.php b/lib/SimpleSAML/Auth/TimeLimitedToken.php index 2c48723f8..c4b126d39 100644 --- a/lib/SimpleSAML/Auth/TimeLimitedToken.php +++ b/lib/SimpleSAML/Auth/TimeLimitedToken.php @@ -14,7 +14,7 @@ class SimpleSAML_Auth_TimeLimitedToken { */ public function __construct( $lifetime = 900, $secretSalt = NULL, $skew = 1) { if ($secretSalt === NULL) { - $secretSalt = SimpleSAML_Utils_Config::getSecretSalt(); + $secretSalt = SimpleSAML\Utils\Config::getSecretSalt(); } $this->secretSalt = $secretSalt; diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 673c5057e..6dff8e3fe 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -979,10 +979,10 @@ class SimpleSAML_Utilities { /** - * @deprecated This function will be removed in SSP 2.0. Please use SimpleSAML_Utils_Config::getSecretSalt() instead. + * @deprecated This function will be removed in SSP 2.0. Please use SimpleSAML\Utils\Config::getSecretSalt() instead. */ public static function getSecretSalt() { - return SimpleSAML_Utils_Config::getSecretSalt(); + return SimpleSAML\Utils\Config::getSecretSalt(); } diff --git a/lib/SimpleSAML/Utils/Config.php b/lib/SimpleSAML/Utils/Config.php index 43ade2aa6..0330c92cd 100644 --- a/lib/SimpleSAML/Utils/Config.php +++ b/lib/SimpleSAML/Utils/Config.php @@ -1,12 +1,12 @@ <?php - +namespace SimpleSAML\Utils; /** * Utility class for SimpleSAMLphp configuration management and manipulation. * * @package SimpleSAMLphp */ -class SimpleSAML_Utils_Config +class Config { /** @@ -21,14 +21,14 @@ class SimpleSAML_Utils_Config * * @return string The secret salt. * - * @throws SimpleSAML_Error_Exception If the secret salt hasn't been configured. - * @author Olav Morken, UNINETT AS <olav.morken@uninett.no> + * @throws \SimpleSAML_Error_Exception If the secret salt hasn't been configured. + * @author Olav Morken, UNINETT AS <olav.morken@uninett.no> */ public static function getSecretSalt() { - $secretSalt = SimpleSAML_Configuration::getInstance()->getString('secretsalt'); + $secretSalt = \SimpleSAML_Configuration::getInstance()->getString('secretsalt'); if ($secretSalt === 'defaultsecretsalt') { - throw new SimpleSAML_Error_Exception('The "secretsalt" configuration option must be set to a secret value.'); + throw new \SimpleSAML_Error_Exception('The "secretsalt" configuration option must be set to a secret value.'); } return $secretSalt; diff --git a/lib/SimpleSAML/Utils/Crypto.php b/lib/SimpleSAML/Utils/Crypto.php index d7eee79ab..d54dfddd9 100644 --- a/lib/SimpleSAML/Utils/Crypto.php +++ b/lib/SimpleSAML/Utils/Crypto.php @@ -34,7 +34,7 @@ class SimpleSAML_Utils_Crypto $ivSize = mcrypt_get_iv_size($enc, $mode); $keySize = mcrypt_get_key_size($enc, $mode); - $key = hash('sha256', SimpleSAML_Utils_Config::getSecretSalt(), true); + $key = hash('sha256', SimpleSAML\Utils\Config::getSecretSalt(), true); $key = substr($key, 0, $keySize); $iv = substr($ciphertext, 0, $ivSize); @@ -75,7 +75,7 @@ class SimpleSAML_Utils_Crypto $ivSize = mcrypt_get_iv_size($enc, $mode); $keySize = mcrypt_get_key_size($enc, $mode); - $key = hash('sha256', SimpleSAML_Utils_Config::getSecretSalt(), true); + $key = hash('sha256', SimpleSAML\Utils\Config::getSecretSalt(), true); $key = substr($key, 0, $keySize); $len = strlen($data); diff --git a/lib/SimpleSAML/Utils/Random.php b/lib/SimpleSAML/Utils/Random.php index 794c02a7e..fc87dcf7c 100644 --- a/lib/SimpleSAML/Utils/Random.php +++ b/lib/SimpleSAML/Utils/Random.php @@ -1,12 +1,11 @@ <?php +namespace SimpleSAML\Utils; + /** * Utility class for random data generation and manipulation. * * @package SimpleSAMLphp */ - -namespace SimpleSAML\Utils; - class Random { diff --git a/modules/consent/lib/Auth/Process/Consent.php b/modules/consent/lib/Auth/Process/Consent.php index 87c954d52..051459aed 100644 --- a/modules/consent/lib/Auth/Process/Consent.php +++ b/modules/consent/lib/Auth/Process/Consent.php @@ -290,7 +290,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt */ public static function getHashedUserID($userid, $source) { - return hash('sha1', $userid . '|' . SimpleSAML_Utils_Config::getSecretSalt() . '|' . $source); + return hash('sha1', $userid . '|' . SimpleSAML\Utils\Config::getSecretSalt() . '|' . $source); } /** @@ -304,7 +304,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt */ public static function getTargetedID($userid, $source, $destination) { - return hash('sha1', $userid . '|' . SimpleSAML_Utils_Config::getSecretSalt() . '|' . $source . '|' . $destination); + return hash('sha1', $userid . '|' . SimpleSAML\Utils\Config::getSecretSalt() . '|' . $source . '|' . $destination); } /** diff --git a/modules/consent/lib/Consent/Store/Cookie.php b/modules/consent/lib/Consent/Store/Cookie.php index 81ce16fbd..b8ca9ba48 100644 --- a/modules/consent/lib/Consent/Store/Cookie.php +++ b/modules/consent/lib/Consent/Store/Cookie.php @@ -199,7 +199,7 @@ class sspmod_consent_Consent_Store_Cookie extends sspmod_consent_Store { assert('is_string($data)'); - $secretSalt = SimpleSAML_Utils_Config::getSecretSalt(); + $secretSalt = SimpleSAML\Utils\Config::getSecretSalt(); return sha1($secretSalt . $data . $secretSalt) . ':' . $data; } diff --git a/modules/core/lib/Auth/Process/TargetedID.php b/modules/core/lib/Auth/Process/TargetedID.php index 4cc86ff53..1151a24c9 100644 --- a/modules/core/lib/Auth/Process/TargetedID.php +++ b/modules/core/lib/Auth/Process/TargetedID.php @@ -100,7 +100,7 @@ class sspmod_core_Auth_Process_TargetedID extends SimpleSAML_Auth_ProcessingFilt } - $secretSalt = SimpleSAML_Utils_Config::getSecretSalt(); + $secretSalt = SimpleSAML\Utils\Config::getSecretSalt(); if (array_key_exists('Source', $state)) { $srcID = self::getEntityId($state['Source']); diff --git a/modules/saml/lib/Auth/Process/PersistentNameID.php b/modules/saml/lib/Auth/Process/PersistentNameID.php index 3f0f478f3..255764f34 100644 --- a/modules/saml/lib/Auth/Process/PersistentNameID.php +++ b/modules/saml/lib/Auth/Process/PersistentNameID.php @@ -64,7 +64,7 @@ class sspmod_saml_Auth_Process_PersistentNameID extends sspmod_saml_BaseNameIDGe $uid = array_values($state['Attributes'][$this->attribute]); /* Just in case the first index is no longer 0. */ $uid = $uid[0]; - $secretSalt = SimpleSAML_Utils_Config::getSecretSalt(); + $secretSalt = SimpleSAML\Utils\Config::getSecretSalt(); $uidData = 'uidhashbase' . $secretSalt; $uidData .= strlen($idpEntityId) . ':' . $idpEntityId; diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php index c67ecf5a3..ae9a6d4fb 100644 --- a/modules/saml/lib/IdP/SAML2.php +++ b/modules/saml/lib/IdP/SAML2.php @@ -628,7 +628,7 @@ class sspmod_saml_IdP_SAML2 { $idpEntityId = $idpMetadata->getString('entityid'); $spEntityId = $spMetadata->getString('entityid'); - $secretSalt = SimpleSAML_Utils_Config::getSecretSalt(); + $secretSalt = SimpleSAML\Utils\Config::getSecretSalt(); $uidData = 'uidhashbase' . $secretSalt; $uidData .= strlen($idpEntityId) . ':' . $idpEntityId; -- GitLab