|
const | STAGE_INIT = 'sspmod_cas_Auth_Source_CAS.state' |
| The string used to identify our states. More...
|
|
const | AUTHID = 'sspmod_cas_Auth_Source_CAS.AuthId' |
| The key of the AuthId field in the state. More...
|
|
|
| casValidate ($ticket, $service) |
| This the most simple version of validating, this provides only authentication validation. More...
|
|
| casServiceValidate ($ticket, $service) |
| Uses the cas service validate, this provides additional attributes. More...
|
|
Definition at line 11 of file CAS.php.
◆ __construct()
sspmod_cas_Auth_Source_CAS::__construct |
( |
|
$info, |
|
|
|
$config |
|
) |
| |
Constructor for this authentication source.
- Parameters
-
array | $info | Information about this authentication source. |
array | $config | Configuration. |
Definition at line 50 of file CAS.php.
References $config, and $info.
51 assert(
'is_array($info)');
52 assert(
'is_array($config)');
57 if (!array_key_exists(
'cas',
$config)){
58 throw new Exception(
'cas authentication source is not properly configured: missing [cas]');
61 if (!array_key_exists(
'ldap',
$config)){
62 throw new Exception(
'ldap authentication source is not properly configured: missing [ldap]');
65 $this->_casConfig =
$config[
'cas'];
66 $this->_ldapConfig =
$config[
'ldap'];
68 if(isset($this->_casConfig[
'serviceValidate'])){
69 $this->_validationMethod =
'serviceValidate';
70 }elseif(isset($this->_casConfig[
'validate'])){
71 $this->_validationMethod =
'validate';
73 throw new Exception(
"validate or serviceValidate not specified");
76 if(isset($this->_casConfig[
'login'])){
77 $this->_loginMethod = $this->_casConfig[
'login'];
79 throw new Exception(
"cas login URL not specified");
◆ authenticate()
sspmod_cas_Auth_Source_CAS::authenticate |
( |
& |
$state | ) |
|
Log-in using cas.
- Parameters
-
array | &$state | Information about the current authentication. |
Definition at line 196 of file CAS.php.
References SimpleSAML_Auth_Source\$authId, $state, array, SimpleSAML\Module\getModuleURL(), SimpleSAML\Utils\HTTP\redirectTrustedURL(), and SimpleSAML_Auth_State\saveState().
197 assert(
'is_array($state)');
209 'service' => $serviceUrl));
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Create styles array
The data for the language used.
static saveState(&$state, $stage, $rawId=false)
Save the state.
◆ casServiceValidate()
sspmod_cas_Auth_Source_CAS::casServiceValidate |
( |
|
$ticket, |
|
|
|
$service |
|
) |
| |
|
private |
Uses the cas service validate, this provides additional attributes.
- Parameters
-
string | $ticket | |
string | $service | |
- Returns
- list username and attributes
Definition at line 114 of file CAS.php.
References $attributes, $failure, $name, $query, $result, $service, $success, $url, array, SimpleSAML\Utils\HTTP\fetch(), SAML2\DOMDocumentFactory\fromString(), is, and to.
Referenced by casValidation().
115 $url = \SimpleSAML\Utils\HTTP::addURLParameters($this->_casConfig[
'serviceValidate'],
array(
122 $xPath =
new DOMXpath($dom);
123 $xPath->registerNamespace(
"cas",
'http://www.yale.edu/tp/cas');
124 $success = $xPath->query(
"/cas:serviceResponse/cas:authenticationSuccess/cas:user");
126 $failure = $xPath->evaluate(
"/cas:serviceResponse/cas:authenticationFailure");
127 throw new Exception(
"Error when validating CAS service ticket: " .
$failure->item(0)->textContent);
131 if ($casattributes = $this->_casConfig[
'attributes']) { # some has attributes in the xml - attributes
is a list of XPath expressions
to get them
133 $attrs = $xPath->query(
$query);
134 foreach ($attrs as $attrvalue)
$attributes[
$name][] = $attrvalue->textContent;
137 $casusername =
$success->item(0)->textContent;
static fetch($url, $context=array(), $getHeaders=false)
Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorizati...
Create styles array
The data for the language used.
◆ casValidate()
sspmod_cas_Auth_Source_CAS::casValidate |
( |
|
$ticket, |
|
|
|
$service |
|
) |
| |
|
private |
This the most simple version of validating, this provides only authentication validation.
- Parameters
-
string | $ticket | |
string | $service | |
- Returns
- list username and attributes
Definition at line 91 of file CAS.php.
References $res, $result, $service, $url, array, and SimpleSAML\Utils\HTTP\fetch().
Referenced by casValidation().
92 $url = \SimpleSAML\Utils\HTTP::addURLParameters($this->_casConfig[
'validate'],
array(
99 if (strcmp(
$res[0],
"yes") == 0) {
102 throw new Exception(
"Failed to validate CAS service ticket: $ticket");
foreach($_POST as $key=> $value) $res
static fetch($url, $context=array(), $getHeaders=false)
Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorizati...
Create styles array
The data for the language used.
◆ casValidation()
sspmod_cas_Auth_Source_CAS::casValidation |
( |
|
$ticket, |
|
|
|
$service |
|
) |
| |
|
protected |
Main validation method, redirects to correct method (keeps finalStep clean)
- Parameters
-
string | $ticket | |
string | $service | |
- Returns
- list username and attributes
Definition at line 153 of file CAS.php.
References $service, casServiceValidate(), and casValidate().
Referenced by finalStep().
154 switch($this->_validationMethod){
158 case 'serviceValidate':
162 throw new Exception(
"validate or serviceValidate not specified");
casServiceValidate($ticket, $service)
Uses the cas service validate, this provides additional attributes.
casValidate($ticket, $service)
This the most simple version of validating, this provides only authentication validation.
◆ finalStep()
sspmod_cas_Auth_Source_CAS::finalStep |
( |
& |
$state | ) |
|
Called by linkback, to finish validate/ finish logging in.
- Parameters
-
- Returns
- list username, casattributes/ldap attributes
Definition at line 172 of file CAS.php.
References $attributes, $service, $state, array, casValidation(), SimpleSAML_Auth_Source\completeAuth(), SimpleSAML\Module\getModuleURL(), and SimpleSAML_Auth_State\saveState().
175 $ticket =
$state[
'cas:ticket'];
179 $ldapattributes =
array();
180 if ($this->_ldapConfig[
'servers']) {
181 $ldap =
new SimpleSAML_Auth_LDAP($this->_ldapConfig[
'servers'], $this->_ldapConfig[
'enable_tls']);
182 $ldapattributes = $ldap->validate($this->_ldapConfig, $username);
184 $attributes = array_merge_recursive($casattributes, $ldapattributes);
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Create styles array
The data for the language used.
casValidation($ticket, $service)
Main validation method, redirects to correct method (keeps finalStep clean)
static completeAuth(&$state)
Complete authentication.
static saveState(&$state, $stage, $rawId=false)
Save the state.
◆ logout()
sspmod_cas_Auth_Source_CAS::logout |
( |
& |
$state | ) |
|
Log out from this authentication source.
This function should be overridden if the authentication source requires special steps to complete a logout operation.
If the logout process requires a redirect, the state should be saved. Once the logout operation is completed, the state should be restored, and completeLogout should be called with the state. If this operation can be completed without showing the user a page, or redirecting, this function should return.
- Parameters
-
array | &$state | Information about the current logout operation. |
Definition at line 226 of file CAS.php.
References $state, SimpleSAML_Auth_State\deleteState(), and SimpleSAML\Utils\HTTP\redirectTrustedURL().
227 assert(
'is_array($state)');
228 $logoutUrl = $this->_casConfig[
'logout'];
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
static deleteState(&$state)
Delete state.
◆ $_casConfig
sspmod_cas_Auth_Source_CAS::$_casConfig |
|
private |
◆ $_ldapConfig
sspmod_cas_Auth_Source_CAS::$_ldapConfig |
|
private |
◆ $_loginMethod
sspmod_cas_Auth_Source_CAS::$_loginMethod |
|
private |
◆ $_validationMethod
sspmod_cas_Auth_Source_CAS::$_validationMethod |
|
private |
◆ AUTHID
const sspmod_cas_Auth_Source_CAS::AUTHID = 'sspmod_cas_Auth_Source_CAS.AuthId' |
The key of the AuthId field in the state.
Definition at line 21 of file CAS.php.
◆ STAGE_INIT
const sspmod_cas_Auth_Source_CAS::STAGE_INIT = 'sspmod_cas_Auth_Source_CAS.state' |
The string used to identify our states.
Definition at line 16 of file CAS.php.
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/cas/lib/Auth/Source/CAS.php