Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Licensed to Jasig under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Jasig licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

Author: Pascal Aubry <pascal.aubry@univ-rennes1.fr>
Author: Olivier Berger <olivier.berger@it-sudparis.eu>
Author: Brett Bieber <brett.bieber@gmail.com>
Author: Joachim Fritschi <jfritschi@freenet.de>
Author: Adam Franco <afranco@middlebury.edu>
Author: Tobias Schiebeck <tobias.schiebeck@manchester.ac.uk>
License: http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
File Size: 4380 lines (155 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

CAS_Client:: (129 methods):
  _htmlFilterOutput()
  printHTMLHeader()
  printHTMLFooter()
  setHTMLHeader()
  setHTMLFooter()
  printf()
  setLang()
  getLangObj()
  getServerVersion()
  _getServerHostname()
  _getServerPort()
  _getServerURI()
  _getServerBaseURL()
  getServerLoginURL()
  setServerLoginURL()
  setServerServiceValidateURL()
  setServerProxyValidateURL()
  setServerSamlValidateURL()
  getServerServiceValidateURL()
  getServerSamlValidateURL()
  getServerProxyValidateURL()
  getServerProxyURL()
  getServerLogoutURL()
  setServerLogoutURL()
  setExtraCurlOption()
  setRequestImplementation()
  setNoClearTicketsFromUrl()
  setCasAttributeParserCallback()
  setPostAuthenticateCallback()
  setSingleSignoutCallback()
  ensureIsProxy()
  markAuthenticationCall()
  wasAuthenticationCalled()
  _ensureAuthenticationCalled()
  wasAuthenticationCallSuccessful()
  ensureAuthenticationCallSuccessful()
  getAuthenticationCallerFile()
  getAuthenticationCallerLine()
  getAuthenticationCallerMethod()
  __construct()
  _setChangeSessionID()
  getChangeSessionID()
  setSessionHandler()
  getSessionValue()
  hasSessionValue()
  setSessionValue()
  removeSessionValue()
  clearSessionValues()
  validateSession()
  _renameSession()
  _setUser()
  getUser()
  _getUser()
  setAttributes()
  getAttributes()
  hasAttributes()
  hasAttribute()
  _hasAttribute()
  getAttribute()
  renewAuthentication()
  forceAuthentication()
  setCacheTimesForAuthRecheck()
  checkAuthentication()
  isAuthenticated()
  isSessionAuthenticated()
  _wasPreviouslyAuthenticated()
  redirectToCas()
  logout()
  _isLogoutRequest()
  handleLogoutRequests()
  getTicket()
  setTicket()
  hasTicket()
  setCasServerCACert()
  setNoCasServerValidation()
  validateCAS10()
  validateSA()
  _setSessionAttributes()
  isProxy()
  _getPGT()
  _setPGT()
  _hasPGT()
  _setCallbackMode()
  _isCallbackMode()
  _setCallbackModeUsingPost()
  _isCallbackModeUsingPost()
  _getCallbackURL()
  setCallbackURL()
  _callback()
  isXmlResponse()
  _initPGTStorage()
  _storePGT()
  _loadPGT()
  setPGTStorage()
  setPGTStorageDb()
  setPGTStorageFile()
  _validatePGT()
  retrievePT()
  _readURL()
  _buildSAMLPayload()
  getProxiedService()
  initializeProxiedService()
  serviceWeb()
  serviceMail()
  getProxies()
  _setProxies()
  getAllowedProxyChains()
  validateCAS20()
  _xml_to_array()
  _parse_json_like_array_value()
  _flatten_array()
  _readExtraAttributesCas20()
  _addAttributeToArray()
  setURL()
  getURL()
  setBaseURL()
  getServiceBaseUrl()
  _setServiceBaseUrl()
  _removeParameterFromQueryString()
  _buildQueryUrl()
  _startsWith()
  _endsWith()
  _sessionIdForTicket()
  setSessionIdSalt()
  _authError()
  _getNodeType()
  addRebroadcastNode()
  addRebroadcastHeader()
  _rebroadcast()


Class: CAS_Client  - X-Ref

The CAS_Client class is a client interface that provides CAS authentication
to PHP applications.

_htmlFilterOutput($str)   X-Ref
This method filters a string by replacing special tokens by appropriate values
and prints it. The corresponding tokens are taken into account:
- __CAS_VERSION__
- __PHPCAS_VERSION__
- __SERVER_BASE_URL__

Used by CAS_Client::PrintHTMLHeader() and CAS_Client::printHTMLFooter().

return: void
param: string $str the string to filter and output

printHTMLHeader($title)   X-Ref
This method prints the header of the HTML output (after filtering). If
CAS_Client::setHTMLHeader() was not used, a default header is output.

return: void
param: string $title the title of the page

printHTMLFooter()   X-Ref
This method prints the footer of the HTML output (after filtering). If
CAS_Client::setHTMLFooter() was not used, a default footer is output.

return: void

setHTMLHeader($header)   X-Ref
This method set the HTML header used for all outputs.

return: void
param: string $header the HTML header.

setHTMLFooter($footer)   X-Ref
This method set the HTML footer used for all outputs.

return: void
param: string $footer the HTML footer.

printf(string $format, ...$values)   X-Ref
Simple wrapper for printf function, that respects
phpCAS verbosity setting.

param: string $format
param: string|int|float ...$values

setLang($lang)   X-Ref
This method is used to set the language used by phpCAS.

return: void
param: string $lang representing the language.

getLangObj()   X-Ref
Create the language

return: CAS_Languages_LanguageInterface object implementing the class

getServerVersion()   X-Ref
This method is used to retrieve the version of the CAS server.

return: string the version of the CAS server.

_getServerHostname()   X-Ref
This method is used to retrieve the hostname of the CAS server.

return: string the hostname of the CAS server.

_getServerPort()   X-Ref
This method is used to retrieve the port of the CAS server.

return: int the port of the CAS server.

_getServerURI()   X-Ref
This method is used to retrieve the URI of the CAS server.

return: string a URI.

_getServerBaseURL()   X-Ref
This method is used to retrieve the base URL of the CAS server.

return: string a URL.

getServerLoginURL($gateway=false,$renew=false)   X-Ref
This method is used to retrieve the login URL of the CAS server.

return: string a URL.
param: bool $gateway true to check authentication, false to force it
param: bool $renew   true to force the authentication with the CAS server

setServerLoginURL($url)   X-Ref
This method sets the login URL of the CAS server.

return: string login url
param: string $url the login URL

setServerServiceValidateURL($url)   X-Ref
This method sets the serviceValidate URL of the CAS server.

return: string serviceValidate URL
param: string $url the serviceValidate URL

setServerProxyValidateURL($url)   X-Ref
This method sets the proxyValidate URL of the CAS server.

return: string proxyValidate URL
param: string $url the proxyValidate URL

setServerSamlValidateURL($url)   X-Ref
This method sets the samlValidate URL of the CAS server.

return: string samlValidate URL
param: string $url the samlValidate URL

getServerServiceValidateURL()   X-Ref
This method is used to retrieve the service validating URL of the CAS server.

return: string serviceValidate URL.

getServerSamlValidateURL()   X-Ref
This method is used to retrieve the SAML validating URL of the CAS server.

return: string samlValidate URL.

getServerProxyValidateURL()   X-Ref
This method is used to retrieve the proxy validating URL of the CAS server.

return: string proxyValidate URL.

getServerProxyURL()   X-Ref
This method is used to retrieve the proxy URL of the CAS server.

return: string proxy URL.

getServerLogoutURL()   X-Ref
This method is used to retrieve the logout URL of the CAS server.

return: string logout URL.

setServerLogoutURL($url)   X-Ref
This method sets the logout URL of the CAS server.

return: string logout url
param: string $url the logout URL

setExtraCurlOption($key, $value)   X-Ref
This method is used to set additional user curl options.

return: void
param: string $key   name of the curl option
param: string $value value of the curl option

setRequestImplementation($className)   X-Ref
Override the default implementation used to make web requests in readUrl().
This class must implement the CAS_Request_RequestInterface.

return: void
param: string $className name of the RequestImplementation class

setNoClearTicketsFromUrl()   X-Ref
Configure the client to not send redirect headers and call exit() on
authentication success. The normal redirect is used to remove the service
ticket from the client's URL, but for running unit tests we need to
continue without exiting.

Needed for testing authentication

return: void

setCasAttributeParserCallback($function, array $additionalArgs = array()   X-Ref
Set a callback function to be run when parsing CAS attributes

The callback function will be passed a XMLNode as its first parameter,
followed by any $additionalArgs you pass.

return: void
param: string $function       callback function to call
param: array  $additionalArgs optional array of arguments

setPostAuthenticateCallback($function, array $additionalArgs = array()   X-Ref
Set a callback function to be run when a user authenticates.

The callback function will be passed a $logoutTicket as its first parameter,
followed by any $additionalArgs you pass. The $logoutTicket parameter is an
opaque string that can be used to map a session-id to the logout request
in order to support single-signout in applications that manage their own
sessions (rather than letting phpCAS start the session).

phpCAS::forceAuthentication() will always exit and forward client unless
they are already authenticated. To perform an action at the moment the user
logs in (such as registering an account, performing logging, etc), register
a callback function here.

return: void
param: callable $function       callback function to call
param: array  $additionalArgs optional array of arguments

setSingleSignoutCallback($function, array $additionalArgs = array()   X-Ref
Set a callback function to be run when a single-signout request is received.

The callback function will be passed a $logoutTicket as its first parameter,
followed by any $additionalArgs you pass. The $logoutTicket parameter is an
opaque string that can be used to map a session-id to the logout request in
order to support single-signout in applications that manage their own sessions
(rather than letting phpCAS start and destroy the session).

return: void
param: callable $function       callback function to call
param: array  $additionalArgs optional array of arguments

ensureIsProxy()   X-Ref
Ensure that this is actually a proxy object or fail with an exception

return: void

markAuthenticationCall($auth)   X-Ref
Mark the caller of authentication. This will help client integraters determine
problems with their code flow if they call a function such as getUser() before
authentication has occurred.

return: null
param: bool $auth True if authentication was successful, false otherwise.

wasAuthenticationCalled()   X-Ref
Answer true if authentication has been checked.

return: bool

_ensureAuthenticationCalled()   X-Ref
Ensure that authentication was checked. Terminate with exception if no
authentication was performed

return: void

wasAuthenticationCallSuccessful()   X-Ref
Answer the result of the authentication call.

Throws a CAS_OutOfSequenceException if wasAuthenticationCalled() is false
and markAuthenticationCall() didn't happen.

return: bool

ensureAuthenticationCallSuccessful()   X-Ref
Ensure that authentication was checked. Terminate with exception if no
authentication was performed

return: void

getAuthenticationCallerFile()   X-Ref
Answer information about the authentication caller.

Throws a CAS_OutOfSequenceException if wasAuthenticationCalled() is false
and markAuthenticationCall() didn't happen.

return: string the file that called authentication

getAuthenticationCallerLine()   X-Ref
Answer information about the authentication caller.

Throws a CAS_OutOfSequenceException if wasAuthenticationCalled() is false
and markAuthenticationCall() didn't happen.

return: int the line that called authentication

getAuthenticationCallerMethod()   X-Ref
Answer information about the authentication caller.

Throws a CAS_OutOfSequenceException if wasAuthenticationCalled() is false
and markAuthenticationCall() didn't happen.

return: string the method that called authentication

__construct($server_version,$proxy,$server_hostname,$server_port,$server_uri,$service_base_url,$changeSessionID = true,\SessionHandlerInterface $sessionHandler = null)   X-Ref
CAS_Client constructor.

return: self a newly created CAS_Client object
param: string                   $server_version  the version of the CAS server
param: bool                     $proxy           true if the CAS client is a CAS proxy
param: string                   $server_hostname the hostname of the CAS server
param: int                      $server_port     the port the CAS server is running on
param: string                   $server_uri      the URI the CAS server is responding on
param: bool                     $changeSessionID Allow phpCAS to change the session_id
param: string|string[]|CAS_ServiceBaseUrl_Interface
param: \SessionHandlerInterface $sessionHandler  the session handler

_setChangeSessionID($allowed)   X-Ref
Set a parameter whether to allow phpCAS to change session_id

return: void
param: bool $allowed allow phpCAS to change session_id

getChangeSessionID()   X-Ref
Get whether phpCAS is allowed to change session_id

return: bool

setSessionHandler(\SessionHandlerInterface $sessionHandler)   X-Ref
Set the session handler.

return: bool
param: \SessionHandlerInterface $sessionHandler

getSessionValue($key, $default = null)   X-Ref
Get a session value using the given key.

return: mixed
param: string $key
param: mixed  $default default value if the key is not set

hasSessionValue($key)   X-Ref
Determine whether a session value is set or not.

To check if a session value is empty or not please use
!!(getSessionValue($key)).

return: bool
param: string $key

setSessionValue($key, $value)   X-Ref
Set a session value using the given key and value.

return: string
param: string $key
param: mixed $value

removeSessionValue($key)   X-Ref
Remove a session value with the given key.

param: string $key

clearSessionValues()   X-Ref
Remove all phpCAS session values.


validateSession($key)   X-Ref
Ensure $key is a string for session utils input

return: bool
param: string $key

_renameSession($ticket)   X-Ref
Renaming the session

return: void
param: string $ticket name of the ticket

_setUser($user)   X-Ref
This method sets the CAS user's login name.

return: void
param: string $user the login name of the authenticated user.

getUser()   X-Ref
This method returns the CAS user's login name.

return: string the login name of the authenticated user

_getUser()   X-Ref
This method returns the CAS user's login name.

return: string the login name of the authenticated user

setAttributes($attributes)   X-Ref
Set an array of attributes

return: void
param: array $attributes a key value array of attributes

getAttributes()   X-Ref
Get an key values arry of attributes

return: array of attributes

hasAttributes()   X-Ref
Check whether attributes are available

return: bool attributes available

hasAttribute($key)   X-Ref
Check whether a specific attribute with a name is available

return: bool is attribute available
param: string $key name of attribute

_hasAttribute($key)   X-Ref
Check whether a specific attribute with a name is available

return: bool is attribute available
param: string $key name of attribute

getAttribute($key)   X-Ref
Get a specific attribute by name

return: string attribute values
param: string $key name of attribute

renewAuthentication()   X-Ref
This method is called to renew the authentication of the user
If the user is authenticated, renew the connection
If not, redirect to CAS

return: bool true when the user is authenticated; otherwise halt.

forceAuthentication()   X-Ref
This method is called to be sure that the user is authenticated. When not
authenticated, halt by redirecting to the CAS server; otherwise return true.

return: bool true when the user is authenticated; otherwise halt.

setCacheTimesForAuthRecheck($n)   X-Ref
Set the number of times authentication will be cached before rechecked.

return: void
param: int $n number of times to wait for a recheck

checkAuthentication()   X-Ref
This method is called to check whether the user is authenticated or not.

return: bool true when the user is authenticated, false when a previous

isAuthenticated($renew=false)   X-Ref
This method is called to check if the user is authenticated (previously or by
tickets given in the URL).

return: bool true when the user is authenticated. Also may redirect to the
param: bool $renew true to force the authentication with the CAS server

isSessionAuthenticated()   X-Ref
This method tells if the current session is authenticated.

return: bool true if authenticated based soley on $_SESSION variable

_wasPreviouslyAuthenticated()   X-Ref
This method tells if the user has already been (previously) authenticated
by looking into the session variables.

return: bool true when the user has already been authenticated; false otherwise.

redirectToCas($gateway=false,$renew=false)   X-Ref
This method is used to redirect the client to the CAS server.
It is used by CAS_Client::forceAuthentication() and
CAS_Client::checkAuthentication().

return: void
param: bool $gateway true to check authentication, false to force it
param: bool $renew   true to force the authentication with the CAS server

logout($params)   X-Ref
This method is used to logout from CAS.

return: void
param: array $params an array that contains the optional url and service

_isLogoutRequest()   X-Ref
Check of the current request is a logout request

return: bool is logout request.

handleLogoutRequests($check_client=true, $allowed_clients=array()   X-Ref
This method handles logout requests.

return: void
param: bool $check_client    true to check the client bofore handling
param: array $allowed_clients an array of host names allowed to send

getTicket()   X-Ref
This method returns the Service Ticket provided in the URL of the request.

return: string service ticket.

setTicket($st)   X-Ref
This method stores the Service Ticket.

return: void
param: string $st The Service Ticket.

hasTicket()   X-Ref
This method tells if a Service Ticket was stored.

return: bool if a Service Ticket has been stored.

setCasServerCACert($cert, $validate_cn)   X-Ref
Set the CA certificate of the CAS server.

return: void
param: string $cert        the PEM certificate file name of the CA that emited
param: bool   $validate_cn valiate CN of the CAS server certificate

setNoCasServerValidation()   X-Ref
Set no SSL validation for the CAS server.

return: void

validateCAS10(&$validate_url,&$text_response,&$tree_response,$renew=false)   X-Ref
This method is used to validate a CAS 1,0 ticket; halt on failure, and
sets $validate_url, $text_reponse and $tree_response on success.

return: bool true when successfull and issue a CAS_AuthenticationException
param: string &$validate_url  reference to the the URL of the request to
param: string &$text_response reference to the response of the CAS
param: string &$tree_response reference to the response of the CAS
param: bool   $renew          true to force the authentication with the CAS server

validateSA(&$validate_url,&$text_response,&$tree_response,$renew=false)   X-Ref
This method is used to validate a SAML TICKET; halt on failure, and sets
$validate_url, $text_reponse and $tree_response on success. These
parameters are used later by CAS_Client::_validatePGT() for CAS proxies.

return: bool true when successfull and issue a CAS_AuthenticationException
param: string &$validate_url  reference to the the URL of the request to
param: string &$text_response reference to the response of the CAS
param: string &$tree_response reference to the response of the CAS
param: bool   $renew          true to force the authentication with the CAS server

_setSessionAttributes($text_response)   X-Ref
This method will parse the DOM and pull out the attributes from the SAML
payload and put them into an array, then put the array into the session.

return: bool true when successfull and false if no attributes a found
param: string $text_response the SAML payload.

isProxy()   X-Ref
Tells if a CAS client is a CAS proxy or not

return: bool true when the CAS client is a CAS proxy, false otherwise

_getPGT()   X-Ref
This method returns the Proxy Granting Ticket given by the CAS server.

return: string the Proxy Granting Ticket.

_setPGT($pgt)   X-Ref
This method stores the Proxy Granting Ticket.

return: void
param: string $pgt The Proxy Granting Ticket.

_hasPGT()   X-Ref
This method tells if a Proxy Granting Ticket was stored.

return: bool true if a Proxy Granting Ticket has been stored.

_setCallbackMode($callback_mode)   X-Ref
This method sets/unsets callback mode.

return: void
param: bool $callback_mode true to set callback mode, false otherwise.

_isCallbackMode()   X-Ref
This method returns true when the CAS client is running in callback mode,
false otherwise.

return: bool A boolean.

_setCallbackModeUsingPost($callback_mode_using_post)   X-Ref
This method sets/unsets usage of POST parameters in callback mode (default/false is GET parameters)

return: void
param: bool $callback_mode_using_post true to use POST, false to use GET (default).

_isCallbackModeUsingPost()   X-Ref
This method returns true when the callback mode is using POST, false otherwise.

return: bool A boolean.

_getCallbackURL()   X-Ref
This method returns the URL that should be used for the PGT callback (in
fact the URL of the current request without any CGI parameter, except if
phpCAS::setFixedCallbackURL() was used).

return: string The callback URL

setCallbackURL($url)   X-Ref
This method sets the callback url.

return: string the callback url
param: string $url url to set callback

_callback()   X-Ref
This method is called by CAS_Client::CAS_Client() when running in callback
mode. It stores the PGT and its PGT Iou, prints its output and halts.

return: void

isXmlResponse()   X-Ref
Check if application/xml or text/xml is pressent in HTTP_ACCEPT header values
when return value is complex and contains attached q parameters.
Example:  HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9

return: bool

_initPGTStorage()   X-Ref
This method is used to initialize the storage of PGT's.
Halts on error.

return: void

_storePGT($pgt,$pgt_iou)   X-Ref
This method stores a PGT. Halts on error.

return: void
param: string $pgt     the PGT to store
param: string $pgt_iou its corresponding Iou

_loadPGT($pgt_iou)   X-Ref
This method reads a PGT from its Iou and deletes the corresponding
storage entry.

return: string mul The PGT corresponding to the Iou, false when not found.
param: string $pgt_iou the PGT Iou

setPGTStorage($storage)   X-Ref
This method can be used to set a custom PGT storage object.

return: void
param: CAS_PGTStorage_AbstractStorage $storage a PGT storage object that

setPGTStorageDb($dsn_or_pdo, $username='', $password='', $table='', $driver_options=null)   X-Ref
This method is used to tell phpCAS to store the response of the
CAS server to PGT requests in a database.

return: void
param: string|PDO $dsn_or_pdo     a dsn string to use for creating a PDO
param: string $username       the username to use when connecting to the
param: string $password       the password to use when connecting to the
param: string $table          the table to use for storing and retrieving
param: string $driver_options any driver options to use when connecting

setPGTStorageFile($path='')   X-Ref
This method is used to tell phpCAS to store the response of the
CAS server to PGT requests onto the filesystem.

return: void
param: string $path the path where the PGT's should be stored

_validatePGT(&$validate_url,$text_response,$tree_response)   X-Ref
This method is used to validate a PGT; halt on failure.

return: bool true when successfull and issue a CAS_AuthenticationException
param: string &$validate_url the URL of the request to the CAS server.
param: string $text_response the response of the CAS server, as is
param: DOMElement $tree_response the response of the CAS server, as a DOM XML

retrievePT($target_service,&$err_code,&$err_msg)   X-Ref
This method is used to retrieve PT's from the CAS server thanks to a PGT.

return: string|false a Proxy Ticket, or false on error.
param: string $target_service the service to ask for with the PT.
param: int &$err_code      an error code (PHPCAS_SERVICE_OK on success).
param: string &$err_msg       an error message (empty on success).

_readURL($url, &$headers, &$body, &$err_msg)   X-Ref
This method is used to acces a remote URL.

return: bool true on success, false otherwise (in this later case, $err_msg
param: string $url      the URL to access.
param: string &$headers an array containing the HTTP header lines of the
param: string &$body    the body of the response, as a string (empty on
param: string &$err_msg an error message, filled on failure.

_buildSAMLPayload()   X-Ref
This method is used to build the SAML POST body sent to /samlValidate URL.

return: string the SOAP-encased SAMLP artifact (the ticket).

getProxiedService($type)   X-Ref
Answer a proxy-authenticated service handler.

return: CAS_ProxiedService
param: string $type The service type. One of:

initializeProxiedService(CAS_ProxiedService $proxiedService)   X-Ref
Initialize a proxied-service handler with the proxy-ticket it should use.

return: void
param: CAS_ProxiedService $proxiedService service handler

serviceWeb($url,&$err_code,&$output)   X-Ref
This method is used to access an HTTP[S] service.

return: bool true on success, false otherwise (in this later case, $err_code
param: string $url       the service to access.
param: int    &$err_code an error code Possible values are
param: string &$output   the output of the service (also used to give an error

serviceMail($url,$serviceUrl,$flags,&$err_code,&$err_msg,&$pt)   X-Ref
This method is used to access an IMAP/POP3/NNTP service.

return: object|false an IMAP stream on success, false otherwise (in this later
param: string $url        a string giving the URL of the service, including
param: string $serviceUrl a string giving for CAS retrieve Proxy ticket
param: string $flags      options given to imap_open().
param: int    &$err_code  an error code Possible values are
param: string &$err_msg   an error message on failure
param: string &$pt        the Proxy Ticket (PT) retrieved from the CAS

getProxies()   X-Ref
Answer an array of proxies that are sitting in front of this application.

This method will only return a non-empty array if we have received and
validated a Proxy Ticket.

return: array

_setProxies($proxies)   X-Ref
Set the Proxy array, probably from persistant storage.

return: void
param: array $proxies An array of proxies

getAllowedProxyChains()   X-Ref
Answer the CAS_ProxyChain_AllowedList object for this client.

return: CAS_ProxyChain_AllowedList

validateCAS20(&$validate_url,&$text_response,&$tree_response, $renew=false)   X-Ref
This method is used to validate a cas 2.0 ST or PT; halt on failure
Used for all CAS 2.0 validations

return: bool true when successfull and issue a CAS_AuthenticationException
param: string &$validate_url  the url of the reponse
param: string &$text_response the text of the repsones
param: DOMElement &$tree_response the domxml tree of the respones
param: bool   $renew          true to force the authentication with the CAS server

_xml_to_array($root, $namespace = "cas")   X-Ref
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.

return: an array of the parsed XML elements
param: string $root       the DOM root element to be parsed
param: string $namespace  namespace of the elements

_parse_json_like_array_value($json_value)   X-Ref
This method parses a "JSON-like array" of strings
into an array of strings

return: array of strings Description
param: string $json_value  the json-like string:

_flatten_array($arr)   X-Ref
This method recursively removes unneccessary hirarchy levels in array-trees.
into an array of strings

return: array the flattened array
param: array $arr the array to flatten

_readExtraAttributesCas20($success_elements)   X-Ref
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.

return: bool true when successfull, halt otherwise by calling
param: DOMNodeList $success_elements payload of the response

_addAttributeToArray(array &$attributeArray, $name, $value)   X-Ref
Add an attribute value to an array of attributes.

return: void
param: array  &$attributeArray reference to array
param: string $name            name of attribute
param: string $value           value of attribute

setURL($url)   X-Ref
This method sets the URL of the current request

return: void
param: string $url url to set for service

getURL()   X-Ref
This method returns the URL of the current request (without any ticket
CGI parameter).

return: string The URL

setBaseURL($url)   X-Ref
This method sets the base URL of the CAS server.

return: string base url
param: string $url the base URL

getServiceBaseUrl()   X-Ref
Answer the CAS_ServiceBaseUrl_Interface object for this client.

return: CAS_ServiceBaseUrl_Interface

_setServiceBaseUrl($name)   X-Ref
This method sets the service base URL used during service URL discovery process.

This is required since phpCAS 1.6.0 to protect the integrity of the authentication.

return: void
param: $name can be any of the following:

_removeParameterFromQueryString($parameterName, $queryString)   X-Ref
Removes a parameter from a query string

return: string new query string
param: string $parameterName name of parameter
param: string $queryString   query string

_buildQueryUrl($url, $query)   X-Ref
This method is used to append query parameters to an url. Since the url
might already contain parameter it has to be detected and to build a proper
URL

return: string url with query params
param: string $url   base url to add the query params to
param: string $query params in query form with & separated

_startsWith($text, $char)   X-Ref
This method tests if a string starts with a given character.

return: bool          true if the $text starts with $char
param: string $text  text to test
param: string $char  character to test for

_endsWith($text, $char)   X-Ref
This method tests if a string ends with a given character

return: bool         true if the $text ends with $char
param: string $text  text to test
param: string $char  character to test for

_sessionIdForTicket($ticket)   X-Ref
Answer a valid session-id given a CAS ticket.

The output must be deterministic to allow single-log-out when presented with
the ticket to log-out.


return: string
param: string $ticket name of the ticket

setSessionIdSalt($salt)   X-Ref
Set a salt/seed for the session-id hash to make it harder to guess.

return: void
param: string $salt

_authError($failure,$cas_url,$no_response=false,$bad_response=false,$cas_response='',$err_code=-1,$err_msg='')   X-Ref
This method is used to print the HTML output when the user was not
authenticated.

return: void
param: string $failure      the failure that occured
param: string $cas_url      the URL the CAS server was asked for
param: bool   $no_response  the response from the CAS server (other
param: bool   $bad_response bad response from the CAS server ($err_code
param: string $cas_response the response of the CAS server
param: int    $err_code     the error code given by the CAS server
param: string $err_msg      the error message given by the CAS server

_getNodeType($nodeURL)   X-Ref
Determine the node type from the URL.

return: int hostname
param: String $nodeURL The node URL.

addRebroadcastNode($rebroadcastNodeUrl)   X-Ref
Store the rebroadcast node for pgtIou/pgtId and logout requests.

return: void
param: string $rebroadcastNodeUrl The rebroadcast node URL.

addRebroadcastHeader($header)   X-Ref
This method is used to add header parameters when rebroadcasting
pgtIou/pgtId or logoutRequest.

return: void
param: string $header Header to send when rebroadcasting.

_rebroadcast($type)   X-Ref
This method rebroadcasts logout/pgtIou requests. Can be LOGOUT,PGTIOU

return: void
param: int $type type of rebroadcasting.