PHP Classes

File: web/SSO/modules/negotiate/www/retry.php

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

Contents

Class file image Download
<?php

/**
 *
 *
 * @author Mathias Meisfjordskar, University of Oslo.
 * <mathias.meisfjordskar@usit.uio.no>
 * @package simpleSAMLphp
 */

$authStateId = $_REQUEST['AuthState'];

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

$state = SimpleSAML_Auth_State::loadState($authStateId, sspmod_negotiate_Auth_Source_Negotiate::STAGEID);

$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
$idpid = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted', 'metaindex');
$idpmeta = $metadata->getMetaData($idpid, 'saml20-idp-hosted');

if (isset(
$idpmeta['auth'])) {
   
$source = SimpleSAML_Auth_Source::getById($idpmeta['auth']);
    if (
$source === NULL)
        throw new
SimpleSAML_Error_BadRequest('Invalid AuthId "' . $idpmeta['auth'] . '" - not found.');

   
$session = SimpleSAML_Session::getSessionFromRequest();
   
$session->setData('negotiate:disable', 'session', FALSE, 24*60*60);
   
SimpleSAML_Logger::debug('Negotiate(retry) - session enabled, retrying.');
   
$source->authenticate($state);
   
assert('FALSE');
} else {
   
SimpleSAML_Logger::error('Negotiate - retry - no "auth" parameter found in IdP metadata.');
   
assert('FALSE');
}