Installation
The phpCAS client can be obtained from Jasig at the following URL: https://wiki.jasig.org/display/casc/phpcas
Unzip the tarball to a location under your DocumentRoot for your PHP application.
tar xzvf CAS-x.x.x.tgz
For brevity, we will refer (going forward) to the location which the tarbell was unziped as PHPCAS_UNZIP_DIR
Configuration
To configure and use phpCAS, you must put the following block at the top of your code.
/* phpCAS CONFIGURATION */ //Import the phpCAS Library include_once('./CAS.php'); // Initialize phpCAS phpCAS::client(SAML_VERSION_1_1, "login.uconn.edu", 443, "cas"); phpCAS::setNoCasServerValidation(); //Perform Authentication phpCAS::forceAuthentication();
Getting Authentication/Authorization Data
To get LDAP attributes asserted by CAS or to get the Authenticated user’s NetID, you will use the example code below after the phpCAS::forceAuthentication().
//Get Authenticated NetID $netid = phpCAS::getUser(); //Get Data from the LDAP Assertion $CASattribute = phpCAS::getAttributes(); $email = $CASattribute['mail'];