diff --git a/docs/simplesamlphp-upgrade-notes-1.14.txt b/docs/simplesamlphp-upgrade-notes-1.14.txt index 9dbadd8133e62f5fc6283b1cb055ab6bbaff273a..a0fcb727d762d27c09cbc169aa2d367deb471c08 100644 --- a/docs/simplesamlphp-upgrade-notes-1.14.txt +++ b/docs/simplesamlphp-upgrade-notes-1.14.txt @@ -87,6 +87,7 @@ The following methods and classes have been deprecated. Refer to the code for al * `SimpleSAML_Auth_Default` * `SimpleSAML_Auth_Default::extractPersistentAuthState()` + * `SimpleSAML_Auth_Default::handleUnsolicitedAuth()` * `SimpleSAML_Utilities` * `SimpleSAML_Utilities::addURLParameter()` * `SimpleSAML_Utilities::aesDecrypt()` diff --git a/lib/SimpleSAML/Auth/Default.php b/lib/SimpleSAML/Auth/Default.php index b50e778f8df2bf0e664fc57302c10b40656b0113..ca28cb2f147ebd3cf2736d8067446e240290df01 100644 --- a/lib/SimpleSAML/Auth/Default.php +++ b/lib/SimpleSAML/Auth/Default.php @@ -76,11 +76,6 @@ class SimpleSAML_Auth_Default { /** - * Extract the persistent authentication state from the state array. - * - * @param array $state The state after the login. - * @return array The persistent authentication state. - * * @deprecated This method will be removed in SSP 2.0. Please use * SimpleSAML_Auth_State::extractPersistentAuthState() instead. */ @@ -227,30 +222,11 @@ class SimpleSAML_Auth_Default { /** - * Handle a unsolicited login operations. - * - * This function creates a session from the received information. It - * will then redirect to the given URL. - * - * This is used to handle IdP initiated SSO. - * - * @param string $authId The id of the authentication source that received - * the request. - * @param array $state A state array. - * @param string $redirectTo The URL we should redirect the user to after - * updating the session. The function will check if the URL is allowed, so - * there is no need to manually check the URL on beforehand. Please refer - * to the 'trusted.url.domains' configuration directive for more - * information about allowing (or disallowing) URLs. + * @deprecated This method will be removed in SSP 2.0. Please use + * sspmod_saml_Auth_Source_SP::handleUnsolicitedAuth() instead. */ public static function handleUnsolicitedAuth($authId, array $state, $redirectTo) { - assert('is_string($authId)'); - assert('is_string($redirectTo)'); - - $session = SimpleSAML_Session::getSessionFromRequest(); - $session->doLogin($authId, SimpleSAML_Auth_State::extractPersistentAuthState($state)); - - \SimpleSAML\Utils\HTTP::redirectUntrustedURL($redirectTo); + sspmod_saml_Auth_Source_SP::handleUnsolicitedAuth($authId, $state, $redirectTo); } } diff --git a/modules/saml/lib/Auth/Source/SP.php b/modules/saml/lib/Auth/Source/SP.php index 569f2b5c6f97310d74ef4d54a64768ad8a061513..cb926f6281e960cb1290e2611fea25171e2a3f7b 100644 --- a/modules/saml/lib/Auth/Source/SP.php +++ b/modules/saml/lib/Auth/Source/SP.php @@ -579,6 +579,29 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source { } + /** + * Handle an unsolicited login operations. + * + * This method creates a session from the information received. It will then redirect to the given URL. This is used + * to handle IdP initiated SSO. This method will never return. + * + * @param string $authId The id of the authentication source that received the request. + * @param array $state A state array. + * @param string $redirectTo The URL we should redirect the user to after updating the session. The function will + * check if the URL is allowed, so there is no need to manually check the URL on beforehand. Please refer to the + * 'trusted.url.domains' configuration directive for more information about allowing (or disallowing) URLs. + */ + public static function handleUnsolicitedAuth($authId, array $state, $redirectTo) { + assert('is_string($authId)'); + assert('is_string($redirectTo)'); + + $session = SimpleSAML_Session::getSessionFromRequest(); + $session->doLogin($authId, SimpleSAML_Auth_State::extractPersistentAuthState($state)); + + \SimpleSAML\Utils\HTTP::redirectUntrustedURL($redirectTo); + } + + /** * Called when we have completed the procssing chain. * @@ -609,7 +632,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source { } else { $redirectTo = $source->getMetadata()->getString('RelayState', '/'); } - SimpleSAML_Auth_Default::handleUnsolicitedAuth($sourceId, $state, $redirectTo); + self::handleUnsolicitedAuth($sourceId, $state, $redirectTo); } SimpleSAML_Auth_Source::completeAuth($state);