PHP Classes

File: web/SSO/modules/cas/www/linkback.php

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/modules/cas/www/linkback.php   Download  
File: web/SSO/modules/cas/www/linkback.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 960 bytes
 

Contents

Class file image Download
<?php

/**
 * Handle linkback() response from CAS.
 */

if (!isset($_GET['stateID'])) {
    throw new
SimpleSAML_Error_BadRequest('Missing stateID parameter.');
}
$stateId = (string)$_GET['stateID'];

if (!isset(
$_GET['ticket'])) {
    throw new
SimpleSAML_Error_BadRequest('Missing ticket parameter.');
}

// sanitize the input
$sid = SimpleSAML_Utilities::parseStateID($stateId);
if (!
is_null($sid['url'])) {
   
SimpleSAML_Utilities::checkURLAllowed($sid['url']);
}

$state = SimpleSAML_Auth_State::loadState($stateId, sspmod_cas_Auth_Source_CAS::STAGE_INIT);
$state['cas:ticket'] = (string)$_GET['ticket'];

/* Find authentication source. */
assert('array_key_exists(sspmod_cas_Auth_Source_CAS::AUTHID, $state)');
$sourceId = $state[sspmod_cas_Auth_Source_CAS::AUTHID];

$source = SimpleSAML_Auth_Source::getById($sourceId);
if (
$source === NULL) {
    throw new
Exception('Could not find authentication source with id ' . $sourceId);
}

$source->finalStep($state);