Skip to content
This repository

PHP5 CAS Authentication library

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 docs
Octocat-spinner-32 src
Octocat-spinner-32 vendor
Octocat-spinner-32 API-0.6.0
Octocat-spinner-32 README.md
Octocat-spinner-32 RELEASE-0.6.0
Octocat-spinner-32 TODO
Octocat-spinner-32 composer.json
Octocat-spinner-32 package.xml
Octocat-spinner-32 package_compatible.xml
README.md

SimpleCAS PHP 5 CAS Client

This is a PHP 5 client library for JA-SIG Central Authentication Service (CAS).

Compatible with servers using version 1 or 2 of the CAS protocol.

Install with Composer

A sample composer.json for your project that might requires SimpleCAS might look like:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/saltybeagle/SimpleCAS.git"
        },
        {
            "type": "pear",
            "url": "http://pear.php.net"
        }
    ],
    "require": {
        "pear-pear/HTTP_Request2": "*",
        "SimpleCAS/SimpleCAS": "dev-master"
    }
}

Manual install

Manually install by downloading the latest release and extracting the files, along with HTTP_Request2 from PEAR.

Quick Example:

<?php

require_once 'SimpleCAS/Autoload.php';
require_once 'HTTP/Request2.php';

$options = array('hostname' => 'login.unl.edu',
                 'port'     => 443,
                 'uri'      => 'cas');
$protocol = new SimpleCAS_Protocol_Version2($options);

$client = SimpleCAS::client($protocol);
$client->forceAuthentication();

if (isset($_GET['logout'])) {
    $client->logout();
}

if ($client->isAuthenticated()) {
    echo '<h1>Authentication Successful!</h1>
          <p>The user\'s login is '.$client->getUsername().'</p>
          <a href="?logout">Logout</a>';
}
?>
Something went wrong with that request. Please try again.