Skip to content
Snippets Groups Projects
Commit 3b2f4e77 authored by Olav Morken's avatar Olav Morken
Browse files

saml: Use RelayState to save return URL for unsoliced response.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1786 44740490-163a-0410-bde0-09ae8108e29a
parent c695a532
No related branches found
No related tags found
No related merge requests found
......@@ -170,6 +170,10 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source {
$ar->setAssertionConsumerServiceURL(SimpleSAML_Module::getModuleURL('saml/sp/saml2-acs.php/' . $this->authId));
$ar->setProtocolBinding(SAML2_Const::BINDING_HTTP_POST);
if (isset($state['SimpleSAML_Auth_Default.ReturnURL'])) {
$ar->setRelayState($state['SimpleSAML_Auth_Default.ReturnURL']);
}
$id = SimpleSAML_Auth_State::saveState($state, 'saml:sp:ssosent-saml2');
$ar->setId($id);
......@@ -386,7 +390,11 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source {
$state['Attributes'] = $authProcState['Attributes'];
if (isset($state['saml:sp:isUnsoliced']) && (bool)$state['saml:sp:isUnsoliced']) {
$redirectTo = $source->getMetadata()->getString('RelayState', '/');
if (isset($state['saml:sp:RelayState'])) {
$redirectTo = $state['saml:sp:RelayState'];
} else {
$redirectTo = $source->getMetadata()->getString('RelayState', '/');
}
SimpleSAML_Auth_Default::handleUnsolicedAuth($sourceId, $state, $redirectTo);
}
......
......@@ -28,6 +28,7 @@ if (!empty($stateId)) {
$state = array(
'saml:sp:isUnsoliced' => TRUE,
'saml:sp:AuthId' => $sourceId,
'saml:sp:RelayState' => $response->getRelayState(),
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment