ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SimpleSAML\IdP\TraditionalLogoutHandler Class Reference
+ Inheritance diagram for SimpleSAML\IdP\TraditionalLogoutHandler:
+ Collaboration diagram for SimpleSAML\IdP\TraditionalLogoutHandler:

Public Member Functions

 __construct (\SimpleSAML_IdP $idp)
 TraditionalLogout constructor. More...
 
 startLogout (array &$state, $assocId)
 Start the logout operation. More...
 
 onResponse ($assocId, $relayState, \SimpleSAML_Error_Exception $error=null)
 Continue the logout operation. More...
 

Private Member Functions

 logoutNextSP (array &$state)
 Picks the next SP and issues a logout request. More...
 

Private Attributes

 $idp
 

Detailed Description

Definition at line 13 of file TraditionalLogoutHandler.php.

Constructor & Destructor Documentation

◆ __construct()

SimpleSAML\IdP\TraditionalLogoutHandler::__construct ( \SimpleSAML_IdP  $idp)

TraditionalLogout constructor.

Parameters
\SimpleSAML_IdP$idpThe IdP to log out from.

Implements SimpleSAML\IdP\LogoutHandlerInterface.

Definition at line 29 of file TraditionalLogoutHandler.php.

References SimpleSAML\IdP\TraditionalLogoutHandler\$idp.

Member Function Documentation

◆ logoutNextSP()

SimpleSAML\IdP\TraditionalLogoutHandler::logoutNextSP ( array &  $state)
private

Picks the next SP and issues a logout request.

This function never returns.

Parameters
array&$stateThe logout state.

Definition at line 42 of file TraditionalLogoutHandler.php.

References $association, $id, SimpleSAML\IdP\TraditionalLogoutHandler\$idp, $relayState, $url, SimpleSAML_IdP\getByState(), SimpleSAML\Logger\info(), SimpleSAML\Utils\HTTP\redirectTrustedURL(), SimpleSAML_Auth_State\saveState(), and SimpleSAML\Logger\warning().

Referenced by SimpleSAML\IdP\TraditionalLogoutHandler\onResponse(), and SimpleSAML\IdP\TraditionalLogoutHandler\startLogout().

43  {
44  $association = array_pop($state['core:LogoutTraditional:Remaining']);
45  if ($association === null) {
46  $this->idp->finishLogout($state);
47  }
48 
49  $relayState = \SimpleSAML_Auth_State::saveState($state, 'core:LogoutTraditional', true);
50 
51  $id = $association['id'];
52  Logger::info('Logging out of '.var_export($id, true).'.');
53 
54  try {
56  $url = call_user_func(array($association['Handler'], 'getLogoutURL'), $idp, $association, $relayState);
58  } catch (\Exception $e) {
59  Logger::warning('Unable to initialize logout to '.var_export($id, true).'.');
60  $this->idp->terminateAssociation($id);
61  $state['core:Failed'] = true;
62 
63  // Try the next SP
64  $this->logoutNextSP($state);
65  assert(false);
66  }
67  }
static getByState(array &$state)
Retrieve the IdP "owning" the state.
Definition: IdP.php:145
if(!array_key_exists('StateId', $_REQUEST)) $id
logoutNextSP(array &$state)
Picks the next SP and issues a logout request.
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
Definition: HTTP.php:959
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
static info($string)
Definition: Logger.php:199
$relayState
static warning($string)
Definition: Logger.php:177
if(!isset($associations[$assocId])) $association
$url
static saveState(&$state, $stage, $rawId=false)
Save the state.
Definition: State.php:194
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onResponse()

SimpleSAML\IdP\TraditionalLogoutHandler::onResponse (   $assocId,
  $relayState,
\SimpleSAML_Error_Exception  $error = null 
)

Continue the logout operation.

This function will never return.

Parameters
string$assocIdThe association that is terminated.
string | null$relayStateThe RelayState from the start of the logout.
\SimpleSAML_Error_Exception | null$errorThe error that occurred during session termination (if any).
Exceptions

Implements SimpleSAML\IdP\LogoutHandlerInterface.

Definition at line 97 of file TraditionalLogoutHandler.php.

References $assocId, $relayState, $state, SimpleSAML\Logger\info(), SimpleSAML_Auth_State\loadState(), SimpleSAML\IdP\TraditionalLogoutHandler\logoutNextSP(), and SimpleSAML\Logger\warning().

98  {
99  assert(is_string($assocId));
100  assert(is_string($relayState) || $relayState === null);
101 
102  if ($relayState === null) {
103  throw new \SimpleSAML_Error_Exception('RelayState lost during logout.');
104  }
105 
106  $state = \SimpleSAML_Auth_State::loadState($relayState, 'core:LogoutTraditional');
107 
108  if ($error === null) {
109  Logger::info('Logged out of '.var_export($assocId, true).'.');
110  $this->idp->terminateAssociation($assocId);
111  } else {
112  Logger::warning('Error received from '.var_export($assocId, true).' during logout:');
113  $error->logWarning();
114  $state['core:Failed'] = true;
115  }
116 
117  $this->logoutNextSP($state);
118  }
logoutNextSP(array &$state)
Picks the next SP and issues a logout request.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
static info($string)
Definition: Logger.php:199
$relayState
static warning($string)
Definition: Logger.php:177
static loadState($id, $stage, $allowMissing=false)
Retrieve saved state.
Definition: State.php:259
if(!isset($_REQUEST['association'])) $assocId
+ Here is the call graph for this function:

◆ startLogout()

SimpleSAML\IdP\TraditionalLogoutHandler::startLogout ( array &  $state,
  $assocId 
)

Start the logout operation.

This function never returns.

Parameters
array&$stateThe logout state.
string$assocIdThe association that started the logout.

Implements SimpleSAML\IdP\LogoutHandlerInterface.

Definition at line 78 of file TraditionalLogoutHandler.php.

References SimpleSAML\IdP\TraditionalLogoutHandler\logoutNextSP().

79  {
80  $state['core:LogoutTraditional:Remaining'] = $this->idp->getAssociations();
81 
82  $this->logoutNextSP($state);
83  }
logoutNextSP(array &$state)
Picks the next SP and issues a logout request.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
+ Here is the call graph for this function:

Field Documentation

◆ $idp

SimpleSAML\IdP\TraditionalLogoutHandler::$idp
private

The documentation for this class was generated from the following file: