Central Authentication Service - Code Examples
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).