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

SAML2-SSOService: Fix IsPassive behaviour.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@695 44740490-163a-0410-bde0-09ae8108e29a
parent 8ef6b855
No related branches found
No related tags found
No related merge requests found
......@@ -182,7 +182,27 @@ if($needAuth && !$isPassive) {
'AuthId' => $authId,
'protocol' => 'saml2',
));
} elseif($needAuth) {
/* We have a passive request, but need authentication. Send back a response indicating that
* the user didn't have a valid session.
*/
try {
/* Generate an SAML 2.0 AuthNResponse message
* With statusCode: urn:oasis:names:tc:SAML:2.0:status:NoPassive
*/
$ar = new SimpleSAML_XML_SAML20_AuthnResponse($config, $metadata);
$authnResponseXML = $ar->generate($idpentityid, $requestcache['Issuer'], $requestcache['RequestID'], null, array(), 'NoPassive');
/* Sending the AuthNResponse using HTTP-Post SAML 2.0 binding. */
$httppost = new SimpleSAML_Bindings_SAML20_HTTPPost($config, $metadata);
$httppost->sendResponse($authnResponseXML, $idpentityid, $requestcache['Issuer'], $requestcache['RelayState']);
} catch(Exception $exception) {
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'GENERATEAUTHNRESPONSE', $exception);
}
/**
* We got an request, and we have a valid session. Then we send an AuthnResponse back to the
* service.
......@@ -202,19 +222,6 @@ if($needAuth && !$isPassive) {
SimpleSAML_Logger::info('SAML2.0 - IdP.SSOService: Sending back AuthnResponse to ' . $spentityid);
if ($isPassive) {
/* Generate an SAML 2.0 AuthNResponse message
With statusCode: urn:oasis:names:tc:SAML:2.0:status:NoPassive
*/
$ar = new SimpleSAML_XML_SAML20_AuthnResponse($config, $metadata);
$authnResponseXML = $ar->generate($idpentityid, $spentityid, $requestcache['RequestID'], null, array(), 'NoPassive');
// Sending the AuthNResponse using HTTP-Post SAML 2.0 binding
$httppost = new SimpleSAML_Bindings_SAML20_HTTPPost($config, $metadata);
$httppost->sendResponse($authnResponseXML, $idpentityid, $spentityid, $requestcache['RelayState']);
exit;
}
/*
* Attribute handling
*/
......
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