Пример #1
0
//$ret = array();
//$ret["status"] = 500;
//echo "<pre>";
//print_r($_SESSION);
//exit;
if (!empty($_GET["logout"])) {
    unset($_SESSION["user"]);
    unset($_SESSION["tequila_key"]);
    echo "<p>Logged out</p>\n";
    echo "<p><a href=\"?\">Login again</a></p>";
    exit;
}
if (!empty($_SESSION["tequila_key"])) {
    $key = $_SESSION["tequila_key"];
    unset($_SESSION["tequila_key"]);
    $attributes = $oClient->fetchAttributes($key);
    if ($attributes) {
        $_SESSION["user"] = $attributes;
        //	} else {
        //		die("f****r");
    }
}
if (empty($_SESSION["user"])) {
    //	echo "<pre>\n";
    //	print_r($_SERVER);
    //}
    //exit;
    //if(!empty($_GET["key"])) {
    //	$attributes = $oClient->fetchAttributes($_GET["key"]);
    //	if($attributes) {
    //		$ret["status"] = 200;
Пример #2
0
<?php

require_once "tequila.php";
$oClient = new TequilaClient();
$ret = array();
$ret["status"] = 500;
if (!empty($_GET["key"])) {
    $attributes = $oClient->fetchAttributes($_GET["key"]);
    if ($attributes) {
        $ret["status"] = 200;
        $ret["attributes"] = $attributes;
    }
} elseif (!empty($_GET["app_url"]) && !empty($_GET["app_name"])) {
    $oClient->SetApplicationName($_GET["app_name"]);
    $oClient->SetApplicationURL($_GET["app_url"]);
    $oClient->SetWantedAttributes(array('uniqueid', 'name', 'firstname', 'unit', 'unitid', 'where', 'group', 'email', 'title'));
    $oClient->SetAllowsFilter("categorie=Shibboleth|categorie=epfl-guests");
    $oClient->createRequest();
    $key = $oClient->GetKey();
    if ($key) {
        $ret["status"] = 200;
        $ret["key"] = $key;
        $ret["redirect"] = $oClient->getAuthenticationUrl();
    }
}
echo json_encode($ret);