File: prp.php

package info (click to toggle)
simplesamlphp 1.19.7-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 42,920 kB
  • sloc: php: 202,044; javascript: 14,867; xml: 2,700; sh: 225; perl: 82; makefile: 70; python: 5
file content (29 lines) | stat: -rw-r--r-- 1,210 bytes parent folder | download | duplicates (2)
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
28
29
<?php

/**
 * ADFS PRP IDP protocol support for SimpleSAMLphp.
 *
 * @author Hans Zandbelt, SURFnet bv, <hans.zandbelt@surfnet.nl>
 * @package SimpleSAMLphp
 */

\SimpleSAML\Logger::info('ADFS - IdP.prp: Accessing ADFS IdP endpoint prp');

$metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler();
$idpEntityId = $metadata->getMetaDataCurrentEntityID('adfs-idp-hosted');
$idp = \SimpleSAML\IdP::getById('adfs:'.$idpEntityId);

if (isset($_GET['wa'])) {
    if ($_GET['wa'] === 'wsignout1.0') {
        \SimpleSAML\Module\adfs\IdP\ADFS::receiveLogoutMessage($idp);
    } elseif ($_GET['wa'] === 'wsignin1.0') {
        \SimpleSAML\Module\adfs\IdP\ADFS::receiveAuthnRequest($idp);
    }
    throw new \Exception("Code should never be reached");
} elseif (isset($_GET['assocId'])) {
    // logout response from ADFS SP
    $assocId = $_GET['assocId']; // Association ID of the SP that sent the logout response
    $relayState = $_GET['relayState']; // Data that was sent in the logout request to the SP. Can be null
    $logoutError = null; // null on success, or an instance of a \SimpleSAML\Error\Exception on failure.
    $idp->handleLogoutResponse($assocId, $relayState, $logoutError);
}