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

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