ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
IFrameLogoutHandler.php
Go to the documentation of this file.
1<?php
2
3namespace SimpleSAML\IdP;
4
7
14{
15
21 private $idp;
22
23
30 {
31 $this->idp = $idp;
32 }
33
40 public function startLogout(array &$state, $assocId)
41 {
42 assert(is_string($assocId) || $assocId === null);
43
44 $associations = $this->idp->getAssociations();
45
46 if (count($associations) === 0) {
47 $this->idp->finishLogout($state);
48 }
49
50 foreach ($associations as $id => &$association) {
52 $association['core:Logout-IFrame:Name'] = $idp->getSPName($id);
53 $association['core:Logout-IFrame:State'] = 'onhold';
54 }
55 $state['core:Logout-IFrame:Associations'] = $associations;
56
57 if (!is_null($assocId)) {
58 $spName = $this->idp->getSPName($assocId);
59 if ($spName === null) {
60 $spName = array('en' => $assocId);
61 }
62
63 $state['core:Logout-IFrame:From'] = $spName;
64 } else {
65 $state['core:Logout-IFrame:From'] = null;
66 }
67
68 $params = array(
69 'id' => \SimpleSAML_Auth_State::saveState($state, 'core:Logout-IFrame'),
70 );
71 if (isset($state['core:Logout-IFrame:InitType'])) {
72 $params['type'] = $state['core:Logout-IFrame:InitType'];
73 }
74
75 $url = Module::getModuleURL('core/idp/logout-iframe.php', $params);
77 }
78
79
90 {
91 assert(is_string($assocId));
92
93 $spId = sha1($assocId);
94 $this->idp->terminateAssociation($assocId);
95
96 $header = <<<HEADER
97<!DOCTYPE html>
98<html>
99 <head>
100 <title>Logout response from %s</title>
101 <script>
102HEADER;
103 printf($header, htmlspecialchars(var_export($assocId, true)));
104 if ($error) {
105 $errorMsg = $error->getMessage();
106 echo('window.parent.logoutFailed("'.$spId.'", "'.addslashes($errorMsg).'");');
107 } else {
108 echo('window.parent.logoutCompleted("'.$spId.'");');
109 }
110 echo <<<FOOTER
111 </script>
112 </head>
113 <body>
114 </body>
115</html>
116FOOTER;
117 exit(0);
118 }
119}
html()
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
exit
Definition: backend.php:16
An exception for terminatinating execution or to throw for unit testing.
startLogout(array &$state, $assocId)
Start the logout operation.
__construct(\SimpleSAML_IdP $idp)
LogoutIFrame constructor.
onResponse($assocId, $relayState, \SimpleSAML_Error_Exception $error=null)
Continue the logout operation.
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
Definition: Module.php:220
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
Definition: HTTP.php:959
static saveState(&$state, $stage, $rawId=false)
Save the state.
Definition: State.php:194
static getByState(array &$state)
Retrieve the IdP "owning" the state.
Definition: IdP.php:145
if(!array_key_exists('StateId', $_REQUEST)) $id
$associations
$relayState
if(!isset($associations[$assocId])) $association
if(!isset($_REQUEST['association'])) $assocId
$url