CAS Client Examples

Apereo maintains numerous CAS client libraries, which support a wide variety of programming languages. Libraries frequently used to “CASify” applications include:

Apache httpd module
mod_auth_cas: An Apache httpd module that supports the CAS protocols.

PHP module
phpCAS client library for CASifying PHP applications.

Examples

Please refer to the README file of the CAS client library and configure the required CAS URLs.

Example 1

phpCAS Library (https://github.com/apereo/phpCAS)

  1. Check this example in the library
  2. Set CAS server name in the phpCAS application
    phpCAS::client(CAS_VERSION_3_0,'cas.ust.hk',443,'cas');
  3. Download and install CA certificate file into a location, and configure
    phpCAS::setCasServerCACert('/path/to/cachain.pem')

Example 2

Ubuntu Apache httpd

  1. Install the mod_auth_cas module
    % sudo apt-get install libapache2-mod-auth-cas
    % sudo a2enmod auth_cas
    % sudo systemctl restart apache2
  2. Modify virtual host configuration to enable CAS protection in required location
    <VirtualHost ...>
        CASLoginURL https://cas.ust.hk/cas/login
        CASValidateURL https://cas.ust.hk/cas/serviceValidate
    
        <Location /secured>
            AuthType CAS
            require valid-user
        </Location>
    </VirtualHost>
    
  3. By default, this module uses system certificate files under directory /etc/ssl/certs/ that already included the CA certificate of the CAS server and there is no need to install the CA certificate file.