mirror of https://github.com/jacekkow/uphpCAS-tests

Jacek Kowalski
2015-09-06 e0a945c2bd03b9d3af72981195c42e53081b0358
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
require_once('uphpCAS.php');
session_start();
 
try {
    $cas = new uphpCAS($_SESSION['cas']);
    if(isset($_SESSION['cafile'])) {
        $cas->setCaFile($_SESSION['cafile']);
    }
    if(isset($_SESSION['method'])) {
        $cas->setMethod($_SESSION['method']);
    }
    if(isset($_SESSION['url'])) {
        $cas->setServiceUrl($_SESSION['url']);
    }
    $user = $cas->authenticate();
    
    echo 'Authenticated as '.$user->user;
} catch(Exception $e) {
    echo 'Jasig authentication failed: '.$e->getMessage();
    die();
}