Introduction and Installation

 

GT_Authen_CAS is a very simple CAS library that is based on the Case_Authen_CAS library from Case Western Reserve University.

It requires the following PEAR packages: Net_URL2, Net_Socket and HTTP_Request2.

For more information about PEAR, visit PEAR Home Page.

If you are using Zend Server, PEAR is installed automatically in the /usr/local/zend/bin directory. To install these required packages:

# /usr/local/zend/bin/pear install Net_URL2# /usr/local/zend/bin/pear install Net_Socket# /usr/local/zend/bin/pear install HTTP_Request2

 

GT_Authen_CAS may be downloaded here

 

Usage

 
 
Most applications will use GT_Authen_CAS like this...
 
//Load GT_Authen_CAS modulerequire_once('GT/Authn/CAS.php');
//Create new GT_Authen_CAS object$cas = new GT_Authn_CAS();
//Force a user to authenticate via GTLogin$cas->forceAuthentication();//Assign the user's GT Account to a variable$GTAccount = $cas->getGTAccount()
 
 
 
If you do not wish to force someone to authenticate but simply check whether or not they are authenticated, a script like this would do the trick:
 
//Load GT_Authen_CAS modulerequire_once('GT/Authn/CAS.php');//Create new GT_Authen_CAS object$cas = new GT_Authn_CAS();//Check if a user is authenticated through GTLogin$cas->checkAuthentication();if ($cas->isLoggedIn()) {//The user is logged in via gtLogin...}
There are two methods to log a user out:
casLogout() - removes site session cookie and sends the user to gtLogin to logout of CAS.
 
localLogout() - simply removes the site session cookie.
 
A sample logout script would be:
 
//Load GT_Authen_CAS modulerequire_once('GT/Authn/CAS.php');//Create new GT_Authen_CAS object$cas = new GT_Authn_CAS();//Destroy session cookie and send user to GTLogin to process CAS logout$cas->casLogout();
 
 
GT_Authen_CAS does not support advanced CAS features such as SAML data or proxying. However, it is easier to configure than phpCAS and makes for a simple drop-in replacement for WebAuth.