|
phpCAS
version 1.4.0
|
Functions | |
| CAS_Client::validateCAS20 (&$validate_url, &$text_response, &$tree_response, $renew=false) | |
| CAS_Client::_xml_to_array ($root, $namespace="cas") | |
| CAS_Client::_parse_json_like_array_value ($json_value) | |
| CAS_Client::_flatten_array ($arr) | |
| CAS_Client::_readExtraAttributesCas20 ($success_elements) | |
| CAS_Client::_addAttributeToArray (array &$attributeArray, $name, $value) | |
|
private |
Add an attribute value to an array of attributes.
| array | &$attributeArray | reference to array |
| string | $name | name of attribute |
| string | $value | value of attribute |
Definition at line 3851 of file Client.php.
|
private |
This method recursively removes unneccessary hirarchy levels in array-trees. into an array of strings
| array | $arr | the array to flatten e.g.: Array ( [attributes] => Array ( [attribute] => Array ( [0] => Array ( [name] => surname [value] => Smith ) [1] => Array ( [name] => givenName [value] => John ) [2] => Array ( [name] => memberOf [value] => ['CN=Staff,OU=Groups,DC=example,DC=edu', 'CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu'] ) ) ) ) |
Definition at line 3745 of file Client.php.
References CAS_Client\_endsWith(), CAS_Client\_parse_json_like_array_value(), and CAS_Client\_startsWith().
Referenced by CAS_Client\_readExtraAttributesCas20().
|
private |
This method parses a "JSON-like array" of strings into an array of strings
| string | $json_value | the json-like string: e.g.: ['CN=Staff,OU=Groups,DC=example,DC=edu', 'CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu'] |
Definition at line 3676 of file Client.php.
References CAS_Client\_endsWith(), and CAS_Client\_startsWith().
Referenced by CAS_Client\_flatten_array().
|
private |
This method will parse the DOM and pull out the attributes from the XML payload and put them into an array, then put the array into the session.
| DOMNodeList | $success_elements | payload of the response |
Definition at line 3810 of file Client.php.
References CAS_Client\_flatten_array(), CAS_Client\_xml_to_array(), CAS_Client\setAttributes(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().
|
private |
This method recursively parses the attribute XML. It also collapses name-value pairs into a single array entry. It parses all common formats of attributes and well formed XML files.
| string | $root | the DOM root element to be parsed |
| string | $namespace | namespace of the elements |
Formats tested:
"Jasig Style" Attributes:
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
<cas:user>jsmith</cas:user>
<cas:attributes>
<cas:attraStyle>RubyCAS</cas:attraStyle>
<cas:surname>Smith</cas:surname>
<cas:givenName>John</cas:givenName>
<cas:memberOf>CN=Staff,OU=Groups,DC=example,DC=edu</cas:memberOf>
<cas:memberOf>CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu</cas:memberOf>
</cas:attributes>
<cas:proxyGrantingTicket>PGTIOU-84678-8a9d2sfa23casd</cas:proxyGrantingTicket>
</cas:authenticationSuccess>
</cas:serviceResponse>
"Jasig Style" Attributes (longer version):
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
<cas:user>jsmith</cas:user>
<cas:attributes>
<cas:attribute>
<cas:name>surname</cas:name>
<cas:value>Smith</cas:value>
</cas:attribute>
<cas:attribute>
<cas:name>givenName</cas:name>
<cas:value>John</cas:value>
</cas:attribute>
<cas:attribute>
<cas:name>memberOf</cas:name>
<cas:value>['CN=Staff,OU=Groups,DC=example,DC=edu', 'CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu']</cas:value>
</cas:attribute>
</cas:attributes>
<cas:proxyGrantingTicket>PGTIOU-84678-8a9d2sfa23casd</cas:proxyGrantingTicket>
</cas:authenticationSuccess>
</cas:serviceResponse>
"RubyCAS Style" attributes
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
<cas:user>jsmith</cas:user>
<cas:attraStyle>RubyCAS</cas:attraStyle>
<cas:surname>Smith</cas:surname>
<cas:givenName>John</cas:givenName>
<cas:memberOf>CN=Staff,OU=Groups,DC=example,DC=edu</cas:memberOf>
<cas:memberOf>CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu</cas:memberOf>
<cas:proxyGrantingTicket>PGTIOU-84678-8a9d2sfa23casd</cas:proxyGrantingTicket>
</cas:authenticationSuccess>
</cas:serviceResponse>
"Name-Value" attributes.
Attribute format from these mailing list thread: http://jasig.275507.n4.nabble.com/CAS-attributes-and-how-they-appear-in-the-CAS-response-td264272.html Note: This is a less widely used format, but in use by at least two institutions.
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
<cas:user>jsmith</cas:user>
<cas:attribute name='attraStyle' value='Name-Value' />
<cas:attribute name='surname' value='Smith' />
<cas:attribute name='givenName' value='John' />
<cas:attribute name='memberOf' value='CN=Staff,OU=Groups,DC=example,DC=edu' />
<cas:attribute name='memberOf' value='CN=Spanish Department,OU=Departments,OU=Groups,DC=example,DC=edu' />
<cas:proxyGrantingTicket>PGTIOU-84678-8a9d2sfa23casd</cas:proxyGrantingTicket>
</cas:authenticationSuccess>
</cas:serviceResponse>
result:
Array (
[surname] => Smith
[givenName] => John
[memberOf] => Array (
[0] => CN=Staff, OU=Groups, DC=example, DC=edu
[1] => CN=Spanish Department, OU=Departments, OU=Groups, DC=example, DC=edu
)
)
Definition at line 3610 of file Client.php.
Referenced by CAS_Client\_readExtraAttributesCas20().
| CAS_Client::validateCAS20 | ( | & | $validate_url, |
| & | $text_response, | ||
| & | $tree_response, | ||
$renew = false |
|||
| ) |
This method is used to validate a cas 2.0 ST or PT; halt on failure Used for all CAS 2.0 validations
| string | &$validate_url | the url of the reponse |
| string | &$text_response | the text of the repsones |
| DOMElement | &$tree_response | the domxml tree of the respones |
| bool | $renew | true to force the authentication with the CAS server |
| CAS_AuthenticationException |
Definition at line 3385 of file Client.php.
References CAS_Client\_getCallbackURL(), CAS_Client\_readURL(), CAS_Client\getAllowedProxyChains(), CAS_Client\getServerProxyValidateURL(), CAS_Client\getServerServiceValidateURL(), CAS_Client\getTicket(), CAS_Client\isProxy(), phpCAS\trace(), and phpCAS\traceBegin().
1.8.13