PHP Classes

File: web/SSO/modules/autotest/www/attributes.php

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

Contents

Class file image Download
<?php

try {
    if (!isset(
$_GET['SourceID'])) {
        throw new
SimpleSAML_Error_BadRequest('Missing SourceID parameter');
    }
   
$sourceId = $_GET['SourceID'];

   
$as = new SimpleSAML_Auth_Simple($sourceId);

    if (!
$as->isAuthenticated()) {
        throw new
SimpleSAML_Error_Exception('Not authenticated.');
    }

   
$attributes = $as->getAttributes();

   
header('Content-Type: text/plain; charset=utf-8');
    echo(
"OK\n");
    foreach (
$attributes as $name => $values) {
        echo(
"$name\n");
        foreach (
$values as $value) {
            echo(
"\t$value\n");
        }
    }

} catch (
Exception $e) {
   
header('HTTP/1.0 500 Internal Server Error');
   
header('Content-Type: text/plain; charset=utf-8');
    echo(
"ERROR\n");
    echo(
$e->getMessage() . "\n");
}