Revision: 1784
Author: olavmrk
Date: Thu Sep 24 04:54:29 2009
Log: saml: Support unsoliced authentication response.
http://code.google.com/p/simplesamlphp/source/detail?r=1784
Modified:
/trunk/modules/saml/lib/Auth/Source/SP.php
/trunk/modules/saml/www/sp/saml2-acs.php
=======================================
--- /trunk/modules/saml/lib/Auth/Source/SP.php Thu Sep 24 04:54:08 2009
+++ /trunk/modules/saml/lib/Auth/Source/SP.php Thu Sep 24 04:54:29 2009
@@ -384,6 +384,12 @@
$source->addLogoutCallback($idp, $state);
$state['Attributes'] = $authProcState['Attributes'];
+
+ if (isset($state['saml:sp:isUnsoliced']) &&
(bool)$state['saml:sp:isUnsoliced']) {
+ $redirectTo =
$source->getMetadata()->getString('RelayState', '/');
+ SimpleSAML_Auth_Default::handleUnsolicedAuth($sourceId,
$state,
$redirectTo);
+ }
+
SimpleSAML_Auth_Source::completeAuth($state);
}
=======================================
--- /trunk/modules/saml/www/sp/saml2-acs.php Thu Sep 24 04:54:08 2009
+++ /trunk/modules/saml/www/sp/saml2-acs.php Thu Sep 24 04:54:29 2009
@@ -14,16 +14,21 @@
}
$relayState = $response->getRelayState();
-if (empty($relayState)) {
- throw new SimpleSAML_Error_BadRequest('Missing relaystate in message
received on AssertionConsumerService endpoint.');
-}
-
-$state =
SimpleSAML_Auth_State::loadState($relayState, 'saml:sp:ssosent-saml2');
-
-/* Check that the authentication source is correct. */
-assert('array_key_exists("saml:sp:AuthId", $state)');
-if ($state['saml:sp:AuthId'] !== $sourceId) {
- throw new SimpleSAML_Error_Exception('The authentication source id in
the
URL does not match the authentication source which sent the request.');
+if (!empty($relayState)) {
+ /* This is a response to a request we sent earlier. */
+ $state =
SimpleSAML_Auth_State::loadState($relayState, 'saml:sp:ssosent-saml2');
+
+ /* Check that the authentication source is correct. */
+ assert('array_key_exists("saml:sp:AuthId", $state)');
+ if ($state['saml:sp:AuthId'] !== $sourceId) {
+ throw new SimpleSAML_Error_Exception('The authentication source
id in
the URL does not match the authentication source which sent the request.');
+ }
+} else {
+ /* This is an unsoliced response. */
+ $state = array(
+ 'saml:sp:isUnsoliced' => TRUE,
+ 'saml:sp:AuthId' => $sourceId,
+ );
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/simplesamlphp-commits?hl=en
-~----------~----~----~----~------~----~------~--~---