snelg / cakephp-3-cas
CAS Authentication for CakePHP 3
Installs: 3 374
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 0
Forks: 2
Open Issues: 2
Requires
- cakephp/cakephp: ^3.5.0
- jasig/phpcas: ~1.3.3
Requires (Dev)
- phpunit/phpunit: ~4.0
- psr/log: ~1.0
README
Very basic CAS Authentication for CakePHP 3.
Installing via composer
Install into your project using composer. For existing applications you can add the following to your composer.json file:
"require": {
"snelg/cakephp-3-cas": "~1.0"
}
And run php composer.phar update
Usage
Load the Cake AuthComponent, including CasAuth.Cas as an authenticator. For example:
$this->loadComponent('Auth'); $this->Auth->config('authenticate', [ 'CasAuth.Cas' => [ 'hostname' => 'cas.mydomain.com', 'uri' => 'authpath']]);
Or combine the load and configuration into one step:
$this->loadComponent('Auth', [ 'authenticate' => [ 'CasAuth.Cas' => [ 'hostname' => 'cas.mydomain.com', 'uri' => 'authpath']]]);
CAS parameters can be specified during Auth->config as above, or by writing to the "CAS" key in Configure::write, e.g.
Configure::write('CAS.hostname', 'cas.myhost.com'); Configure::write('CAS.port', 8443);
Parameters
- hostname is required
- port defaults to 443
- uri defaults to '' (an empty string)
- debug (optional) if true, then phpCAS will write debug info to logs/phpCAS.log
- cert_path (optional) if set, then phpCAS will use the specified CA certificate file to verify the CAS server
- curlopts (optional) key/value paired array of additional CURL parameters to pass through to phpCAS::setExtraCurlOption, e.g.
'curlopts' => [CURLOPT_PROXY => 'http://proxy:5543', CURLOPT_CRLF => true]