ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
IFrameLogoutHandler.php
Go to the documentation of this file.
1<?php
2
3namespace SimpleSAML\IdP;
4
7
8
15{
16
22 private $idp;
23
24
31 {
32 $this->idp = $idp;
33 }
34
41 public function startLogout(array &$state, $assocId)
42 {
43 assert('is_string($assocId) || is_null($assocId)');
44
45 $associations = $this->idp->getAssociations();
46
47 if (count($associations) === 0) {
48 $this->idp->finishLogout($state);
49 }
50
51 foreach ($associations as $id => &$association) {
53 $association['core:Logout-IFrame:Name'] = $idp->getSPName($id);
54 $association['core:Logout-IFrame:State'] = 'onhold';
55 }
56 $state['core:Logout-IFrame:Associations'] = $associations;
57
58 if (!is_null($assocId)) {
59 $spName = $this->idp->getSPName($assocId);
60 if ($spName === null) {
61 $spName = array('en' => $assocId);
62 }
63
64 $state['core:Logout-IFrame:From'] = $spName;
65 } else {
66 $state['core:Logout-IFrame:From'] = null;
67 }
68
69 $params = array(
70 'id' => \SimpleSAML_Auth_State::saveState($state, 'core:Logout-IFrame'),
71 );
72 if (isset($state['core:Logout-IFrame:InitType'])) {
73 $params['type'] = $state['core:Logout-IFrame:InitType'];
74 }
75
76 $url = Module::getModuleURL('core/idp/logout-iframe.php', $params);
78 }
79
80
91 {
92 assert('is_string($assocId)');
93
94 $spId = sha1($assocId);
95 $this->idp->terminateAssociation($assocId);
96
97 $header = <<<HEADER
98<!DOCTYPE html>
99<html>
100 <head>
101 <title>Logout response from %s</title>
102 <script>
103HEADER;
104 printf($header, htmlspecialchars(var_export($assocId, true)));
105 if ($error) {
106 $errorMsg = $error->getMessage();
107 echo('window.parent.logoutFailed("'.$spId.'", "'.addslashes($errorMsg).'");');
108 } else {
109 echo('window.parent.logoutCompleted("'.$spId.'");');
110 }
111 echo <<<FOOTER
112 </script>
113 </head>
114 <body>
115 </body>
116</html>
117FOOTER;
118 exit(0);
119 }
120}
html()
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
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:303
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
Definition: HTTP.php:962
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:152
if(!array_key_exists('StateId', $_REQUEST)) $id
$error
Definition: Error.php:17
$associations
$relayState
if(!isset($associations[$assocId])) $association
if(!isset($_REQUEST['association'])) $assocId
$url
$params
Definition: disable.php:11