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

Central Authentication Service - Code Examples

Code examples retrieving CAS values from the httpd environment using PHP assuming mod_auth_cas.


On pubweb, the mod_auth_cas client is used. This CAS client sets server environment variables, enabling you to access CAS attributes set for the enhanced pubweb site. Only the CAS attributes enabled for the 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 LDAP).

KeywordsCAS, services, pubweb, php, attributes, programming, pub, web   Doc ID103487
OwnerRichard F.GroupIT Knowledge Base
Created2020-07-01 07:59:24Updated2023-05-25 16:58:57
SitesIT Knowledge Base
Feedback  0   0