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.

Pubweb

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']; ?>

PHP

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

$_SERVER{'HTTP_CAS_YOURCASATTRIBUTE'}

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

See Also:




Keywords:CAS, services, pubweb, php, attributes, programming, pub, web   Doc ID:103487
Owner:Steve S.Group:IT Knowledge Base
Created:2020-07-01 06:59 CSTUpdated:2021-08-19 10:03 CST
Sites:IT Knowledge Base
Feedback:  0   0