Skip to content
Snippets Groups Projects
Commit 1b13fcfc authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Cleaning up iframeLogoutResponse code

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@831 44740490-163a-0410-bde0-09ae8108e29a
parent 50ac4095
No related branches found
No related tags found
No related merge requests found
...@@ -254,48 +254,6 @@ foreach ($listofsps AS $spentityid) { ...@@ -254,48 +254,6 @@ foreach ($listofsps AS $spentityid) {
/*
try {
$logoutrequest = $session->getLogoutRequest();
if (!$logoutrequest) {
throw new Exception('Could not get reference to the logout request.');
}
$rg = new SimpleSAML_XML_SAML20_LogoutResponse($config, $metadata);
$logoutResponseXML = $rg->generate($idpentityid, $logoutrequest->getIssuer(), $logoutrequest->getRequestID(), 'IdP');
$httpredirect = new SimpleSAML_Bindings_SAML20_HTTPRedirect($config, $metadata);
$relayState = SimpleSAML_Utilities::selfURL();
if (isset($_GET['RelayState'])) {
$relayState = $_GET['RelayState'];
}
$logoutresponse = $httpredirect->getRedirectURL($logoutResponseXML, $logoutrequest->getIssuer(), $relayState, 'SingleLogoutService', 'SAMLResponse', 'IdP');
} catch(Exception $exception) {
$et = new SimpleSAML_XHTML_Template($config, 'error.php');
$et->data['header'] = 'Error sending response to service';
$et->data['message'] = 'Some error occured when trying to issue the logout response, and send it to the SP.';
$et->data['e'] = $exception;
$et->show();
}
*/
......
<?php <?php
require_once('../../_include.php'); /**
* This SAML 2.0 endpoint can receive incomming LogoutResponses.
*
* @author Andreas kre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
* @package simpleSAMLphp
* @version $Id$
*/
require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Utilities.php'); require_once('../../_include.php');
require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Session.php');
require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Metadata/MetaDataStorageHandler.php');
require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/XML/SAML20/LogoutRequest.php');
require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/XML/SAML20/LogoutResponse.php');
require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Bindings/SAML20/HTTPRedirect.php');
//require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Bindings/SAML20/HTTPPost.php');
require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/XHTML/Template.php');
sleep(rand(1,6)); sleep(rand(1,6));
session_start();
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
$session = SimpleSAML_Session::getInstance();
SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutServiceiFrameResponse: Accessing SAML 2.0 IdP endpoint SingleLogoutServiceResponse (iFrame version)');
if (!$config->getValue('enable.saml20-idp', false))
SimpleSAML_Utilities::fatalError(isset($session) ? $session->getTrackID() : null, 'NOACCESS');
try {
$idpentityid = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
} catch (Exception $exception) {
SimpleSAML_Utilities::fatalError($session->getTrackID(), 'METADATA', $exception);
}
SimpleSAML_Logger::debug('SAML2.0 - IdP.SingleLogoutServiceiFrame: Got IdP entity id: ' . $idpentityid);
$idpentityid = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted');
$session = SimpleSAML_Session::getInstance();
//$session->dump_sp_sessions();
...@@ -37,13 +46,21 @@ if (isset($_GET['SAMLResponse'])) { ...@@ -37,13 +46,21 @@ if (isset($_GET['SAMLResponse'])) {
$session->set_sp_logout_completed($logoutresponse->getIssuer()); $session->set_sp_logout_completed($logoutresponse->getIssuer());
error_log('IdP LogoutService: got LogoutResponse at SingleLogoutServiceAjaxResponse from ' . $logoutresponse->getIssuer() . ' '); SimpleSAML_Logger::info('SAML2.0 - IdP.SingleLogoutServiceiFrameResponse: Logging out completed');
echo 'OK'; echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Logout OK</title>
</head>
<body>OK</body>
</html>';
} else { } else {
error_log('Error on SingleLogoutServiceAjaxResponse'); SimpleSAML_Utilities::fatalError($session->getTrackID(), 'SLOSERVICEPARAMS' new Exception('No valid SAMLResponse found? Probably some error in remote partys metadata that sends something to this endpoint that is not SAML LogoutResponses') );
echo 'Not set: SAMLResponse'; echo 'Not set: SAMLResponse';
} }
......
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