ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
logout-iframe-done.php
Go to the documentation of this file.
1<?php
2
3if (!isset($_REQUEST['id'])) {
4 throw new SimpleSAML_Error_BadRequest('Missing required parameter: id');
5}
6$state = SimpleSAML_Auth_State::loadState($_REQUEST['id'], 'core:Logout-IFrame');
8
9$associations = $idp->getAssociations();
10
11if (!isset($_REQUEST['cancel'])) {
12 SimpleSAML\Logger::stats('slo-iframe done');
13 SimpleSAML_Stats::log('core:idp:logout-iframe:page', array('type' => 'done'));
14 $SPs = $state['core:Logout-IFrame:Associations'];
15} else {
16 // user skipped global logout
17 SimpleSAML\Logger::stats('slo-iframe skip');
18 SimpleSAML_Stats::log('core:idp:logout-iframe:page', array('type' => 'skip'));
19 $SPs = array(); // no SPs should have been logged out
20 $state['core:Failed'] = true; // mark as partial logout
21}
22
23// find the status of all SPs
24foreach ($SPs as $assocId => &$sp) {
25 $spId = 'logout-iframe-'.sha1($assocId);
26
27 if (isset($_REQUEST[$spId])) {
28 $spStatus = $_REQUEST[$spId];
29 if ($spStatus === 'completed' || $spStatus === 'failed') {
30 $sp['core:Logout-IFrame:State'] = $spStatus;
31 }
32 }
33
34 if (!isset($associations[$assocId])) {
35 $sp['core:Logout-IFrame:State'] = 'completed';
36 }
37}
38
39
40// terminate the associations
41foreach ($SPs as $assocId => $sp) {
42 if ($sp['core:Logout-IFrame:State'] === 'completed') {
43 $idp->terminateAssociation($assocId);
44 } else {
45 SimpleSAML\Logger::warning('Unable to terminate association with '.var_export($assocId, true).'.');
46 if (isset($sp['saml:entityID'])) {
47 $spId = $sp['saml:entityID'];
48 } else {
49 $spId = $assocId;
50 }
51 SimpleSAML\Logger::stats('slo-iframe-fail '.$spId);
52 SimpleSAML_Stats::log('core:idp:logout-iframe:spfail', array('sp' => $spId));
53 $state['core:Failed'] = true;
54 }
55}
56
57// we are done
58$idp->finishLogout($state);
An exception for terminatinating execution or to throw for unit testing.
static warning($string)
Definition: Logger.php:177
static stats($string)
Definition: Logger.php:222
static loadState($id, $stage, $allowMissing=false)
Retrieve saved state.
Definition: State.php:259
static getByState(array &$state)
Retrieve the IdP "owning" the state.
Definition: IdP.php:145
static log($event, array $data=array())
Notify about an event.
Definition: Stats.php:71
$associations
if(!isset($_REQUEST['id'])) $state
if(!isset($_REQUEST['association'])) $assocId
$spStatus