2017 © Pedro Peláez
 

library php-cas

A PHP library to authenticate users using CAS

image

cobookman/php-cas

A PHP library to authenticate users using CAS

  • Sunday, April 27, 2014
  • by cobookman
  • Repository
  • 2 Watchers
  • 2 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

php-cas

Uses the CAS login system to login users. Will return the username, and set the superglobal variables for basic HTTP Authentication., (*1)

To use, first install composer:, (*2)

curl -s https://getcomposer.org/installer | php

Then create a composer.json file which lists PHP-CAS as a dependency, (*3)

{
    "require": {
        "cobookman/php-cas": "dev-master"
    }
}

Next, install php-cas, and all other dependencies (or required packages) by running:, (*4)

php composer.phar install

In your application's index.php (or root file) add the following lines:, (*5)

<?php
require 'vendor/autoload.php';

$cas = new cobookman\PHPCAS(array(
  'serviceURL' => 'http://critique.gatech.edu', 
  'casURL' => 'https://login.gatech.edu/cas'    
));
$username = $cas->auth();
//At this point user has been logged in or user redirected to login page (script is killed).
//username stored in:       $_SERVER["REMOTE_USER"]
//a fake password stored in the password field:
//  $_SERVER["PHP_AUTH_PW"] = hash('sha512', $username);
/*
  Application Code
  ....
*/

By running $cas->auth() the user is validated against CAS. If the user was not logged in, he is sent to the cas login page, and upon successful login is redirected back to this page (service URL). Then the username is stored in the basic HTTP authentication variables : $_SERVER["REMOTE_USER"]., (*6)

If you have any questions feel free to email me at cobookman [at] gmail [dot] com, (*7)

The Versions

27/04 2014

dev-master

9999999-dev http://github.com/cobookman/php-cas

A PHP library to authenticate users using CAS

  Sources   Download

The Requires

  • php >=5.3.0

 

cas