forked from SAML-Toolkits/php-saml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslo.php
27 lines (20 loc) · 814 Bytes
/
slo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
/**
* SAMPLE Code to demonstrate how to initiate a SAML Single Log Out request
*
* When the user visits this URL, the browser will be redirected to the SLO
* IdP with an SLO request.
*/
require_once '../_toolkit_loader.php';
$samlSettings = new OneLogin_Saml2_Settings();
$idpData = $samlSettings->getIdPData();
if (isset($idpData['singleLogoutService']) && isset($idpData['singleLogoutService']['url'])) {
$sloUrl = $idpData['singleLogoutService']['url'];
} else {
throw new Exception("The IdP does not support Single Log Out");
}
$logoutRequest = new OneLogin_Saml2_LogoutRequest($samlSettings);
$samlRequest = $logoutRequest->getRequest();
$parameters = array('SAMLRequest' => $samlRequest);
$url = OneLogin_Saml2_Utils::redirect($sloUrl, $parameters, true);
header("Location: $url");