ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
CAS_Client Class Reference

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

+ Collaboration diagram for CAS_Client:

Public Member Functions

 printHTMLHeader ($title)
 This method prints the header of the HTML output (after filtering). More...
 
 printHTMLFooter ()
 This method prints the footer of the HTML output (after filtering). More...
 
 setHTMLHeader ($header)
 This method set the HTML header used for all outputs. More...
 
 setHTMLFooter ($footer)
 This method set the HTML footer used for all outputs. More...
 
 setLang ($lang)
 This method is used to set the language used by phpCAS. More...
 
 getLangObj ()
 Create the language. More...
 
 getServerVersion ()
 This method is used to retrieve the version of the CAS server. More...
 
 getServerLoginURL ($gateway=false, $renew=false)
 This method is used to retrieve the login URL of the CAS server. More...
 
 setServerLoginURL ($url)
 This method sets the login URL of the CAS server. More...
 
 setServerServiceValidateURL ($url)
 This method sets the serviceValidate URL of the CAS server. More...
 
 setServerProxyValidateURL ($url)
 This method sets the proxyValidate URL of the CAS server. More...
 
 setServerSamlValidateURL ($url)
 This method sets the samlValidate URL of the CAS server. More...
 
 getServerServiceValidateURL ()
 This method is used to retrieve the service validating URL of the CAS server. More...
 
 getServerSamlValidateURL ()
 This method is used to retrieve the SAML validating URL of the CAS server. More...
 
 getServerProxyValidateURL ()
 This method is used to retrieve the proxy validating URL of the CAS server. More...
 
 getServerProxyURL ()
 This method is used to retrieve the proxy URL of the CAS server. More...
 
 getServerLogoutURL ()
 This method is used to retrieve the logout URL of the CAS server. More...
 
 setServerLogoutURL ($url)
 This method sets the logout URL of the CAS server. More...
 
 setExtraCurlOption ($key, $value)
 This method is used to set additional user curl options. More...
 
 setRequestImplementation ($className)
 Override the default implementation used to make web requests in readUrl(). More...
 
 setNoClearTicketsFromUrl ()
 Configure the client to not send redirect headers and call exit() on authentication success. More...
 
 setCasAttributeParserCallback ($function, array $additionalArgs=array())
 Set a callback function to be run when parsing CAS attributes. More...
 
 setPostAuthenticateCallback ($function, array $additionalArgs=array())
 Set a callback function to be run when a user authenticates. More...
 
 setSingleSignoutCallback ($function, array $additionalArgs=array())
 Set a callback function to be run when a single-signout request is received. More...
 
 ensureIsProxy ()
 Ensure that this is actually a proxy object or fail with an exception. More...
 
 markAuthenticationCall ($auth)
 Mark the caller of authentication. More...
 
 wasAuthenticationCalled ()
 Answer true if authentication has been checked. More...
 
 wasAuthenticationCallSuccessful ()
 Answer the result of the authentication call. More...
 
 ensureAuthenticationCallSuccessful ()
 Ensure that authentication was checked. More...
 
 getAuthenticationCallerFile ()
 Answer information about the authentication caller. More...
 
 getAuthenticationCallerLine ()
 Answer information about the authentication caller. More...
 
 getAuthenticationCallerMethod ()
 Answer information about the authentication caller. More...
 
 __construct ( $server_version, $proxy, $server_hostname, $server_port, $server_uri, $changeSessionID=true)
 CAS_Client constructor. More...
 
 getChangeSessionID ()
 Get whether phpCas is allowed to change session_id. More...
 
 getUser ()
 This method returns the CAS user's login name. More...
 
 setAttributes ($attributes)
 Set an array of attributes. More...
 
 getAttributes ()
 Get an key values arry of attributes. More...
 
 hasAttributes ()
 Check whether attributes are available. More...
 
 hasAttribute ($key)
 Check whether a specific attribute with a name is available. More...
 
 getAttribute ($key)
 Get a specific attribute by name. More...
 
 renewAuthentication ()
 This method is called to renew the authentication of the user If the user is authenticated, renew the connection If not, redirect to CAS. More...
 
 forceAuthentication ()
 This method is called to be sure that the user is authenticated. More...
 
 setCacheTimesForAuthRecheck ($n)
 Set the number of times authentication will be cached before rechecked. More...
 
 checkAuthentication ()
 This method is called to check whether the user is authenticated or not. More...
 
 isAuthenticated ($renew=false)
 This method is called to check if the user is authenticated (previously or by tickets given in the URL). More...
 
 isSessionAuthenticated ()
 This method tells if the current session is authenticated. More...
 
 redirectToCas ($gateway=false, $renew=false)
 This method is used to redirect the client to the CAS server. More...
 
 logout ($params)
 This method is used to logout from CAS. More...
 
 handleLogoutRequests ($check_client=true, $allowed_clients=false)
 This method handles logout requests. More...
 
 getTicket ()
 This method returns the Service Ticket provided in the URL of the request. More...
 
 setTicket ($st)
 This method stores the Service Ticket. More...
 
 hasTicket ()
 This method tells if a Service Ticket was stored. More...
 
 setCasServerCACert ($cert, $validate_cn)
 Set the CA certificate of the CAS server. More...
 
 setNoCasServerValidation ()
 Set no SSL validation for the CAS server. More...
 
 validateCAS10 (&$validate_url, &$text_response, &$tree_response, $renew=false)
 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. More...
 
 validateSA (&$validate_url, &$text_response, &$tree_response, $renew=false)
 This method is used to validate a SAML TICKET; halt on failure, and sets $validate_url, $text_reponse and $tree_response on success. More...
 
 isProxy ()
 Tells if a CAS client is a CAS proxy or not. More...
 
 setCallbackURL ($url)
 This method sets the callback url. More...
 
 setPGTStorage ($storage)
 This method can be used to set a custom PGT storage object. More...
 
 setPGTStorageDb ( $dsn_or_pdo, $username='', $password='', $table='', $driver_options=null)
 This method is used to tell phpCAS to store the response of the CAS server to PGT requests in a database. More...
 
 setPGTStorageFile ($path='')
 This method is used to tell phpCAS to store the response of the CAS server to PGT requests onto the filesystem. More...
 
 retrievePT ($target_service, &$err_code, &$err_msg)
 This method is used to retrieve PT's from the CAS server thanks to a PGT. More...
 
 getProxiedService ($type)
 Answer a proxy-authenticated service handler. More...
 
 initializeProxiedService (CAS_ProxiedService $proxiedService)
 Initialize a proxied-service handler with the proxy-ticket it should use. More...
 
 serviceWeb ($url, &$err_code, &$output)
 This method is used to access an HTTP[S] service. More...
 
 serviceMail ($url, $serviceUrl, $flags, &$err_code, &$err_msg, &$pt)
 This method is used to access an IMAP/POP3/NNTP service. More...
 
 getProxies ()
 Answer an array of proxies that are sitting in front of this application. More...
 
 getAllowedProxyChains ()
 Answer the CAS_ProxyChain_AllowedList object for this client. More...
 
 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. More...
 
 setURL ($url)
 This method sets the URL of the current request. More...
 
 getURL ()
 This method returns the URL of the current request (without any ticket CGI parameter). More...
 
 setBaseURL ($url)
 This method sets the base URL of the CAS server. More...
 
 addRebroadcastNode ($rebroadcastNodeUrl)
 Store the rebroadcast node for pgtIou/pgtId and logout requests. More...
 
 addRebroadcastHeader ($header)
 This method is used to add header parameters when rebroadcasting pgtIou/pgtId or logoutRequest. More...
 

Data Fields

const HOSTNAME = 0
 Constants used for determining rebroadcast node type. More...
 
const IP = 1
 
const LOGOUT = 0
 Constants used for determining rebroadcast type (logout or pgtIou/pgtId). More...
 
const PGTIOU = 1
 

Private Member Functions

 _htmlFilterOutput ($str)
 This method filters a string by replacing special tokens by appropriate values and prints it. More...
 
 _getServerHostname ()
 This method is used to retrieve the hostname of the CAS server. More...
 
 _getServerPort ()
 This method is used to retrieve the port of the CAS server. More...
 
 _getServerURI ()
 This method is used to retrieve the URI of the CAS server. More...
 
 _getServerBaseURL ()
 This method is used to retrieve the base URL of the CAS server. More...
 
 _ensureAuthenticationCalled ()
 Ensure that authentication was checked. More...
 
 _setChangeSessionID ($allowed)
 Set a parameter whether to allow phpCas to change session_id. More...
 
 _setUser ($user)
 This method sets the CAS user's login name. More...
 
 _getUser ()
 This method returns the CAS user's login name. More...
 
 _hasAttribute ($key)
 Check whether a specific attribute with a name is available. More...
 
 _wasPreviouslyAuthenticated ()
 This method tells if the user has already been (previously) authenticated by looking into the session variables. More...
 
 _isLogoutRequest ()
 Check of the current request is a logout request. More...
 
 _setSessionAttributes ($text_response)
 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. More...
 
 _getPGT ()
 This method returns the Proxy Granting Ticket given by the CAS server. More...
 
 _setPGT ($pgt)
 This method stores the Proxy Granting Ticket. More...
 
 _hasPGT ()
 This method tells if a Proxy Granting Ticket was stored. More...
 
 _setCallbackMode ($callback_mode)
 This method sets/unsets callback mode. More...
 
 _isCallbackMode ()
 This method returns true when the CAs client is running i callback mode, false otherwise. More...
 
 _getCallbackURL ()
 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). More...
 
 _callback ()
 This method is called by CAS_Client::CAS_Client() when running in callback mode. More...
 
 _initPGTStorage ()
 This method is used to initialize the storage of PGT's. More...
 
 _storePGT ($pgt, $pgt_iou)
 This method stores a PGT. More...
 
 _loadPGT ($pgt_iou)
 This method reads a PGT from its Iou and deletes the corresponding storage entry. More...
 
 _validatePGT (&$validate_url, $text_response, $tree_response)
 This method is used to validate a PGT; halt on failure. More...
 
 _readURL ($url, &$headers, &$body, &$err_msg)
 This method is used to acces a remote URL. More...
 
 _buildSAMLPayload ()
 This method is used to build the SAML POST body sent to /samlValidate URL. More...
 
 _setProxies ($proxies)
 Set the Proxy array, probably from persistant storage. More...
 
 _readExtraAttributesCas20 ($success_elements)
 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. More...
 
 _addAttributeToArray (array &$attributeArray, $name, $value)
 Add an attribute value to an array of attributes. More...
 
 _getClientUrl ()
 Try to figure out the phpCas client URL with possible Proxys / Ports etc. More...
 
 _isHttps ()
 This method checks to see if the request is secured via HTTPS. More...
 
 _removeParameterFromQueryString ($parameterName, $queryString)
 Removes a parameter from a query string. More...
 
 _buildQueryUrl ($url, $query)
 This method is used to append query parameters to an url. More...
 
 _renameSession ($ticket)
 Renaming the session. More...
 
 _authError ( $failure, $cas_url, $no_response, $bad_response='', $cas_response='', $err_code='', $err_msg='')
 This method is used to print the HTML output when the user was not authenticated. More...
 
 _getNodeType ($nodeURL)
 Determine the node type from the URL. More...
 
 _rebroadcast ($type)
 This method rebroadcasts logout/pgtIou requests. More...
 

Private Attributes

 $_output_header
 A string used to print the header of HTML pages. More...
 
 $_output_footer
 A string used to print the footer of HTML pages. More...
 
 $_lang = PHPCAS_LANG_DEFAULT
 A string corresponding to the language used by phpCAS. More...
 
 $_server
 a record to store information about the CAS server. More...
 
 $_curl_options = array()
 An array to store extra curl options. More...
 
 $_requestImplementation = 'CAS_Request_CurlRequest'
 The class to instantiate for making web requests in readUrl(). More...
 
 $_clearTicketsFromUrl = true
 
 $_casAttributeParserCallbackFunction = null
 
 $_casAttributeParserCallbackArgs = array()
 
 $_postAuthenticateCallbackFunction = null
 
 $_postAuthenticateCallbackArgs = array()
 
 $_signoutCallbackFunction = null
 
 $_signoutCallbackArgs = array()
 
 $_authentication_caller
 
 $_change_session_id
 A variable to whether phpcas will use its own session handling. More...
 
 $_user
 The Authenticated user. More...
 
 $_attributes
 The Authenticated users attributes. More...
 
 $_cache_times_for_auth_recheck
 An integer that gives the number of times authentication will be cached before rechecked. More...
 
 $_ticket
 The Ticket provided in the URL of the request if present (empty otherwise). More...
 
 $_cas_server_ca_cert
 the certificate of the CAS server CA. More...
 
 $_cas_server_cn_validate
 validate CN of the CAS server certificate More...
 
 $_no_cas_server_validation
 Set to true not to validate the CAS server. More...
 
 $_proxy
 A boolean telling if the client is a CAS proxy or not. More...
 
 $_serviceCookieJar
 Handler for managing service cookies. More...
 
 $_pgt
 the Proxy Grnting Ticket given by the CAS server (empty otherwise). More...
 
 $_callback_mode
 each PHP script using phpCAS in proxy mode is its own callback to get the PGT back from the CAS server. More...
 
 $_callback_url
 the URL that should be used for the PGT callback (in fact the URL of the current request without any CGI parameter). More...
 
 $_pgt_storage
 an instance of a class inheriting of PGTStorage, used to deal with PGT storage. More...
 
 $_proxies = array()
 This array will store a list of proxies in front of this application. More...
 
 $_allowed_proxy_chains
 
 $_url
 the URL of the current request (without any ticket CGI parameter). More...
 
 $_rebroadcast = false
 Boolean of whether to rebroadcast pgtIou/pgtId and logoutRequest, and array of the nodes. More...
 
 $_rebroadcast_nodes = array()
 
 $_rebroadcast_headers = array()
 An array to store extra rebroadcast curl options. More...
 

Detailed Description

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

Definition at line 51 of file Client.php.


The documentation for this class was generated from the following file: