PHP Classes

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

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/modules/openid/www/linkback.php   Download  
File: web/SSO/modules/openid/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: 1,050 bytes
 

Contents

Class file image Download
<?php

/* Find the authentication state. */
if (!array_key_exists('AuthState', $_REQUEST) || empty($_REQUEST['AuthState'])) {
    throw new
SimpleSAML_Error_BadRequest('Missing mandatory parameter: AuthState');
}

$authState = $_REQUEST['AuthState'];

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

$state = SimpleSAML_Auth_State::loadState($authState, 'openid:auth');
$sourceId = $state['openid:AuthId'];
$authSource = SimpleSAML_Auth_Source::getById($sourceId);
if (
$authSource === NULL) {
    throw new
SimpleSAML_Error_BadRequest('Invalid AuthId \'' . $sourceId . '\' - not found.');
}

try {
   
$authSource->postAuth($state);
   
/* postAuth() should never return. */
   
assert('FALSE');
} catch (
SimpleSAML_Error_Exception $e) {
   
SimpleSAML_Auth_State::throwException($state, $e);
} catch (
Exception $e) {
   
SimpleSAML_Auth_State::throwException($state, new SimpleSAML_Error_AuthSource($sourceId, 'Error on OpenID linkback endpoint.', $e));
}