Topics Map > Services > Systems and Infrastructure for IT Partners > NDSU Authentication for Your Services (CAS/InCommon)

Central Authentication Service - Code Examples

Notice: If you are looking for resources on HyFlex teaching, please visit our Teach HyFlex Page

Below are code examples for CAS for Pubweb and PHP.


On pubweb, the mod_auth_cas client is used. This CAS client sets server environment variables, enabling you to access CAS attributes set for your enhanced site. Only the CAS attributes enabled for your enhanced site will be available. Access the server variables using your programming language of choice (assuming it is available on pubweb), for example PHP or Perl.

HTML documents cannot retrieve CAS attributes, even though the document itself cannot be accessed without logging in to CAS. A common workaround to adapt existing HTML documents is to rename the file from .htm(l) to .php, adding PHP code snippets where needed, for example, <?php echo $_SERVER['HTTP_CAS_UID']; ?> 


Get the attributes from the environment, where each attribute is in the format HTTP_CAS_YOURCASATTRIBUTE


For example, $_SERVER{'HTTP_CAS_MAIL'} to get the logged-in user's email address (according to NDSU LDAP).

Keywords:CAS, services, pubweb, php, attributes, programming, pub, web   Doc ID:103487
Owner:Michael R.Group:IT Knowledge Base
Created:2020-07-01 07:59 CDTUpdated:2020-08-24 14:36 CDT
Sites:IT Knowledge Base
Feedback:  0   0