|
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 12 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.
52 assert(is_array(
$info));
58 if (!array_key_exists(
'cas',
$config)) {
59 throw new Exception(
'cas authentication source is not properly configured: missing [cas]');
62 if (!array_key_exists(
'ldap',
$config)) {
63 throw new Exception(
'ldap authentication source is not properly configured: missing [ldap]');
66 $this->_casConfig =
$config[
'cas'];
67 $this->_ldapConfig =
$config[
'ldap'];
69 if (isset($this->_casConfig[
'serviceValidate'])) {
70 $this->_validationMethod =
'serviceValidate';
71 } elseif(isset($this->_casConfig[
'validate'])) {
72 $this->_validationMethod =
'validate';
74 throw new Exception(
"validate or serviceValidate not specified");
77 if (isset($this->_casConfig[
'login'])) {
78 $this->_loginMethod = $this->_casConfig[
'login'];
80 throw new Exception(
"cas login URL not specified");
◆ authenticate()
sspmod_cas_Auth_Source_CAS::authenticate |
( |
& |
$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 118 of file CAS.php.
References $attributes, $failure, $name, $query, $result, $success, $url, SimpleSAML\Utils\HTTP\fetch(), and SAML2\DOMDocumentFactory\fromString().
Referenced by casValidation().
120 $url = \SimpleSAML\Utils\HTTP::addURLParameters(
121 $this->_casConfig[
'serviceValidate'],
124 'service' => $service,
130 $xPath =
new DOMXpath($dom);
131 $xPath->registerNamespace(
"cas",
'http://www.yale.edu/tp/cas');
132 $success = $xPath->query(
"/cas:serviceResponse/cas:authenticationSuccess/cas:user");
134 $failure = $xPath->evaluate(
"/cas:serviceResponse/cas:authenticationFailure");
135 throw new Exception(
"Error when validating CAS service ticket: " .
$failure->item(0)->textContent);
138 if ($casattributes = $this->_casConfig[
'attributes']) { # some has attributes
in the xml - attributes
is a list
of XPath expressions to
get them
140 $attrs = $xPath->query(
$query);
141 foreach ($attrs as $attrvalue) {
146 $casusername =
$success->item(0)->textContent;
if(array_key_exists('yes', $_REQUEST)) $attributes
static fetch($url, $context=array(), $getHeaders=false)
Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorizati...
◆ 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 93 of file CAS.php.
References $res, $result, $url, and SimpleSAML\Utils\HTTP\fetch().
Referenced by casValidation().
95 $url = \SimpleSAML\Utils\HTTP::addURLParameters($this->_casConfig[
'validate'], array(
97 'service' => $service,
102 if (strcmp(
$res[0],
"yes") == 0) {
103 return array(
$res[1], array());
105 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...
◆ 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 161 of file CAS.php.
References casServiceValidate(), and casValidate().
Referenced by finalStep().
163 switch ($this->_validationMethod)
168 case 'serviceValidate':
172 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 182 of file CAS.php.
References $attributes, $config, $state, casValidation(), SimpleSAML_Auth_Source\completeAuth(), SimpleSAML\Module\getModuleURL(), SimpleSAML_Configuration\loadFromArray(), SimpleSAML_Auth_State\saveState(), and SimpleSAML_Auth_LDAP\validate().
184 $ticket =
$state[
'cas:ticket'];
187 list($username, $casattributes) = $this->
casValidation($ticket, $service);
188 $ldapattributes = array();
191 'Authentication source ' . var_export($this->authId,
true));
192 if ($this->_ldapConfig[
'servers']) {
195 $config->getBoolean(
'enable_tls',
false),
196 $config->getBoolean(
'debug',
false),
197 $config->getInteger(
'timeout', 0),
198 $config->getInteger(
'port', 389),
199 $config->getBoolean(
'referrals',
true)
201 $ldapattributes = $ldap->
validate($this->_ldapConfig, $username);
203 $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.
validate($config, $username, $password=null)
Enter description here...
if(array_key_exists('yes', $_REQUEST)) $attributes
casValidation($ticket, $service)
Main validation method, redirects to correct method (keeps finalStep clean)
static completeAuth(&$state)
Complete authentication.
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.
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 243 of file CAS.php.
References $state, SimpleSAML_Auth_State\deleteState(), and SimpleSAML\Utils\HTTP\redirectTrustedURL().
246 $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 22 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 17 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