ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
logout-iframe-post.php
Go to the documentation of this file.
1 <?php
2 
3 if (!isset($_REQUEST['idp'])) {
4  throw new SimpleSAML_Error_BadRequest('Missing "idp" parameter.');
5 }
6 $idp = (string) $_REQUEST['idp'];
8 
9 if (!isset($_REQUEST['association'])) {
10  throw new SimpleSAML_Error_BadRequest('Missing "association" parameter.');
11 }
12 $assocId = urldecode($_REQUEST['association']);
13 
14 $relayState = null;
15 if (isset($_REQUEST['RelayState'])) {
16  $relayState = (string) $_REQUEST['RelayState'];
17 }
18 
19 $associations = $idp->getAssociations();
20 if (!isset($associations[$assocId])) {
21  throw new SimpleSAML_Error_BadRequest('Invalid association id.');
22 }
24 
26 $idpMetadata = $idp->getConfig();
27 $spMetadata = $metadata->getMetaDataConfig($association['saml:entityID'], 'saml20-sp-remote');
28 
30 $lr->setSessionIndex($association['saml:SessionIndex']);
31 $lr->setNameId($association['saml:NameID']);
32 
33 $assertionLifetime = $spMetadata->getInteger('assertion.lifetime', null);
34 if ($assertionLifetime === null) {
35  $assertionLifetime = $idpMetadata->getInteger('assertion.lifetime', 300);
36 }
37 $lr->setNotOnOrAfter(time() + $assertionLifetime);
38 
39 $encryptNameId = $spMetadata->getBoolean('nameid.encryption', null);
40 if ($encryptNameId === null) {
41  $encryptNameId = $idpMetadata->getBoolean('nameid.encryption', false);
42 }
43 if ($encryptNameId) {
45 }
46 
47 SimpleSAML_Stats::log('saml:idp:LogoutRequest:sent', array(
48  'spEntityID' => $association['saml:entityID'],
49  'idpEntityID' => $idpMetadata->getString('entityid'),
50 ));
51 
52 $bindings = array(\SAML2\Constants::BINDING_HTTP_POST);
53 
54 $dst = $spMetadata->getDefaultEndpoint('SingleLogoutService', $bindings);
56 $lr->setDestination($dst['Location']);
57 $lr->setRelayState($relayState);
58 
59 $binding->send($lr);
static getMetadataHandler()
This function retrieves the current instance of the metadata handler.
$dst
$assertionLifetime
static getById($id)
Retrieve an IdP by ID.
Definition: IdP.php:124
static getBinding($urn)
Retrieve a binding with the given URN.
Definition: Binding.php:28
if(isset($_REQUEST['RelayState'])) $associations
$metadata
static buildLogoutRequest(SimpleSAML_Configuration $srcMetadata, SimpleSAML_Configuration $dstMetadata)
Build a logout request based on information in the metadata.
Definition: Message.php:536
$spMetadata
$encryptNameId
$bindings
$relayState
static getEncryptionKey(SimpleSAML_Configuration $metadata)
Retrieve the encryption key for the given entity.
Definition: Message.php:865
if(!isset($associations[$assocId])) $association
$lr
if(!isset($_REQUEST['idp'])) $idp
$idpMetadata
if(!isset($_REQUEST['association'])) $assocId
$binding
static log($event, array $data=array())
Notify about an event.
Definition: Stats.php:71