Skip to content
Snippets Groups Projects
Commit d89759f4 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Move SimpleSAML_Auth_Default::handleUnsolicitedAuth() to...

Move SimpleSAML_Auth_Default::handleUnsolicitedAuth() to sspmod_saml_Auth_Source_SP::handleUnsolicitedAuth() and deprecate the former.
parent 8e4c8b69
Branches
Tags
No related merge requests found
...@@ -87,6 +87,7 @@ The following methods and classes have been deprecated. Refer to the code for al ...@@ -87,6 +87,7 @@ The following methods and classes have been deprecated. Refer to the code for al
* `SimpleSAML_Auth_Default` * `SimpleSAML_Auth_Default`
* `SimpleSAML_Auth_Default::extractPersistentAuthState()` * `SimpleSAML_Auth_Default::extractPersistentAuthState()`
* `SimpleSAML_Auth_Default::handleUnsolicitedAuth()`
* `SimpleSAML_Utilities` * `SimpleSAML_Utilities`
* `SimpleSAML_Utilities::addURLParameter()` * `SimpleSAML_Utilities::addURLParameter()`
* `SimpleSAML_Utilities::aesDecrypt()` * `SimpleSAML_Utilities::aesDecrypt()`
......
...@@ -76,11 +76,6 @@ class SimpleSAML_Auth_Default { ...@@ -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 * @deprecated This method will be removed in SSP 2.0. Please use
* SimpleSAML_Auth_State::extractPersistentAuthState() instead. * SimpleSAML_Auth_State::extractPersistentAuthState() instead.
*/ */
...@@ -227,30 +222,11 @@ class SimpleSAML_Auth_Default { ...@@ -227,30 +222,11 @@ class SimpleSAML_Auth_Default {
/** /**
* Handle a unsolicited login operations. * @deprecated This method will be removed in SSP 2.0. Please use
* * sspmod_saml_Auth_Source_SP::handleUnsolicitedAuth() instead.
* 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.
*/ */
public static function handleUnsolicitedAuth($authId, array $state, $redirectTo) { public static function handleUnsolicitedAuth($authId, array $state, $redirectTo) {
assert('is_string($authId)'); sspmod_saml_Auth_Source_SP::handleUnsolicitedAuth($authId, $state, $redirectTo);
assert('is_string($redirectTo)');
$session = SimpleSAML_Session::getSessionFromRequest();
$session->doLogin($authId, SimpleSAML_Auth_State::extractPersistentAuthState($state));
\SimpleSAML\Utils\HTTP::redirectUntrustedURL($redirectTo);
} }
} }
...@@ -579,6 +579,29 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source { ...@@ -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. * Called when we have completed the procssing chain.
* *
...@@ -609,7 +632,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source { ...@@ -609,7 +632,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source {
} else { } else {
$redirectTo = $source->getMetadata()->getString('RelayState', '/'); $redirectTo = $source->getMetadata()->getString('RelayState', '/');
} }
SimpleSAML_Auth_Default::handleUnsolicitedAuth($sourceId, $state, $redirectTo); self::handleUnsolicitedAuth($sourceId, $state, $redirectTo);
} }
SimpleSAML_Auth_Source::completeAuth($state); SimpleSAML_Auth_Source::completeAuth($state);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment