class-CAS_Client

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.
Overview

Classes

Interfaces

Exceptions

Functions

Class CAS_Client

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

Package: PhpCAS
Category: Authentication
License: Apache License 2.0
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
Link: https://wiki.jasig.org/display/CASC/phpCAS
Class: CAS_Client
Located at shared/cas/source/CAS/Client.php
Methods summary
private
# _htmlFilterOutput( string $str )

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

public
# printHTMLHeader( string $title )

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

public
# printHTMLFooter( )

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

public
# setHTMLHeader( string $header )

This method set the HTML header used for all outputs.

public
# setHTMLFooter( string $footer )

This method set the HTML footer used for all outputs.

public
# setLang( string $lang )

This method is used to set the language used by phpCAS.

public CAS_Languages_LanguageInterface
# getLangObj( )

Create the language

public string
# getServerVersion( )

This method is used to retrieve the version of the CAS server.

private string
# _getServerHostname( )

This method is used to retrieve the hostname of the CAS server.

private string
# _getServerPort( )

This method is used to retrieve the port of the CAS server.

private string
# _getServerURI( )

This method is used to retrieve the URI of the CAS server.

private string
# _getServerBaseURL( )

This method is used to retrieve the base URL of the CAS server.

public a
# getServerLoginURL( boolean $gateway = false, boolean $renew = false )

This method is used to retrieve the login URL of the CAS server.

public string
# setServerLoginURL( string $url )

This method sets the login URL of the CAS server.

public string
# setServerServiceValidateURL( string $url )

This method sets the serviceValidate URL of the CAS server.

public string
# setServerProxyValidateURL( string $url )

This method sets the proxyValidate URL of the CAS server.

public string
# setServerSamlValidateURL( string $url )

This method sets the samlValidate URL of the CAS server.

public string
# getServerServiceValidateURL( )

This method is used to retrieve the service validating URL of the CAS server.

public string
# getServerSamlValidateURL( )

This method is used to retrieve the SAML validating URL of the CAS server.

public string
# getServerProxyValidateURL( )

This method is used to retrieve the proxy validating URL of the CAS server.

public string
# getServerProxyURL( )

This method is used to retrieve the proxy URL of the CAS server.

public string
# getServerLogoutURL( )

This method is used to retrieve the logout URL of the CAS server.

public string
# setServerLogoutURL( string $url )

This method sets the logout URL of the CAS server.

public
# setExtraCurlOption( string $key, string $value )

This method is used to set additional user curl options.

public
# setRequestImplementation( string $className )

Override the default implementation used to make web requests in readUrl(). This class must implement the CAS_Request_RequestInterface.

public
# setNoClearTicketsFromUrl( )

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.

public
# setCasAttributeParserCallback( string $function, array $additionalArgs = array() )

Set a callback function to be run when parsing CAS attributes

public
# setPostAuthenticateCallback( string $function, array $additionalArgs = array() )

Set a callback function to be run when a user authenticates.

public
# setSingleSignoutCallback( string $function, array $additionalArgs = array() )

Set a callback function to be run when a single-signout request is received.

public
# ensureIsProxy( )

Ensure that this is actually a proxy object or fail with an exception

public null
# markAuthenticationCall( boolean $auth )

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.

public boolean
# wasAuthenticationCalled( )

Answer true if authentication has been checked.

private
# _ensureAuthenticationCalled( )

Ensure that authentication was checked. Terminate with exception if no authentication was performed

public boolean
# wasAuthenticationCallSuccessful( )

Answer the result of the authentication call.

public
# ensureAuthenticationCallSuccessful( )

Ensure that authentication was checked. Terminate with exception if no authentication was performed

public array
# getAuthenticationCallerFile( )

Answer information about the authentication caller.

public array
# getAuthenticationCallerLine( )

Answer information about the authentication caller.

public array
# getAuthenticationCallerMethod( )

Answer information about the authentication caller.

public a
# __construct( string $server_version, boolean $proxy, string $server_hostname, integer $server_port, string $server_uri, boolean $changeSessionID = true )

CAS_Client constructor.

private
# _setChangeSessionID( boolean $allowed )

Set a parameter whether to allow phpCas to change session_id

public boolean
# getChangeSessionID( )

Get whether phpCas is allowed to change session_id

private
# _setUser( string $user )

This method sets the CAS user's login name.

public string
# getUser( )

This method returns the CAS user's login name.

private string
# _getUser( )

This method returns the CAS user's login name.

public
# setAttributes( array $attributes )

Set an array of attributes

public arry
# getAttributes( )

Get an key values arry of attributes

public boolean
# hasAttributes( )

Check whether attributes are available

public boolean
# hasAttribute( string $key )

Check whether a specific attribute with a name is available

private boolean
# _hasAttribute( string $key )

Check whether a specific attribute with a name is available

public string
# getAttribute( string $key )

Get a specific attribute by name

public true
# 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

public true
# forceAuthentication( )

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.

public
# setCacheTimesForAuthRecheck( integer $n )

Set the number of times authentication will be cached before rechecked.

public true
# checkAuthentication( )

This method is called to check whether the user is authenticated or not.

public true
# isAuthenticated( boolean $renew = false )

This method is called to check if the user is authenticated (previously or by tickets given in the URL).

public true
# isSessionAuthenticated( )

This method tells if the current session is authenticated.

private true
# _wasPreviouslyAuthenticated( )

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

public
# redirectToCas( boolean $gateway = false, boolean $renew = false )

This method is used to redirect the client to the CAS server. It is used by CAS_Client::forceAuthentication() and CAS_Client::checkAuthentication().

public
# logout( array $params )

This method is used to logout from CAS.

private boolean
# _isLogoutRequest( )

Check of the current request is a logout request

public
# handleLogoutRequests( boolean $check_client = true, boolean $allowed_clients = false )

This method handles logout requests.

public string
# getTicket( )

This method returns the Service Ticket provided in the URL of the request.

public
# setTicket( string $st )

This method stores the Service Ticket.

public boolean
# hasTicket( )

This method tells if a Service Ticket was stored.

public
# setCasServerCACert( string $cert, boolean $validate_cn )

Set the CA certificate of the CAS server.

public
# setNoCasServerValidation( )

Set no SSL validation for the CAS server.

public boolean
# validateCAS10( string & $validate_url, string & $text_response, string & $tree_response, boolean $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.

public boolean
# validateSA( string & $validate_url, string & $text_response, string & $tree_response, boolean $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. These parameters are used later by CAS_Client::_validatePGT() for CAS proxies.

private boolean
# _setSessionAttributes( string $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.

public true
# isProxy( )

Tells if a CAS client is a CAS proxy or not

private string
# _getPGT( )

This method returns the Proxy Granting Ticket given by the CAS server.

private
# _setPGT( string $pgt )

This method stores the Proxy Granting Ticket.

private true
# _hasPGT( )

This method tells if a Proxy Granting Ticket was stored.

private
# _setCallbackMode( boolean $callback_mode )

This method sets/unsets callback mode.

private A
# _isCallbackMode( )

This method returns true when the CAs client is running i callback mode, false otherwise.

private The
# _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).

public
# setCallbackURL( string $url )

This method sets the callback url.

private
# _callback( )

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.

private
# _initPGTStorage( )

This method is used to initialize the storage of PGT's. Halts on error.

private
# _storePGT( string $pgt, string $pgt_iou )

This method stores a PGT. Halts on error.

private mul
# _loadPGT( string $pgt_iou )

This method reads a PGT from its Iou and deletes the corresponding storage entry.

public
# setPGTStorage( CAS_PGTStorage_AbstractStorage $storage )

This method can be used to set a custom PGT storage object.

public
# setPGTStorageDb( string $dsn_or_pdo, string $username = '', string $password = '', string $table = '', string $driver_options = null )

This method is used to tell phpCAS to store the response of the CAS server to PGT requests in a database.

public
# setPGTStorageFile( string $path = '' )

This method is used to tell phpCAS to store the response of the CAS server to PGT requests onto the filesystem.

private boolean
# _validatePGT( string & $validate_url, string $text_response, string $tree_response )

This method is used to validate a PGT; halt on failure.

public a
# retrievePT( string $target_service, string & $err_code, string & $err_msg )

This method is used to retrieve PT's from the CAS server thanks to a PGT.

private true
# _readURL( string $url, string & $headers, string & $body, string & $err_msg )

This method is used to acces a remote URL.

private the
# _buildSAMLPayload( )

This method is used to build the SAML POST body sent to /samlValidate URL.

public CAS_ProxiedService
# getProxiedService( string $type )

Answer a proxy-authenticated service handler.

public
# initializeProxiedService( CAS_ProxiedService $proxiedService )

Initialize a proxied-service handler with the proxy-ticket it should use.

public true
# serviceWeb( string $url, integer & $err_code, string & $output )

This method is used to access an HTTP[S] service.

public object
# serviceMail( string $url, string $serviceUrl, string $flags, integer & $err_code, string & $err_msg, string & $pt )

This method is used to access an IMAP/POP3/NNTP service.

public array
# getProxies( )

Answer an array of proxies that are sitting in front of this application.

private
# _setProxies( array $proxies )

Set the Proxy array, probably from persistant storage.

public CAS_ProxyChain_AllowedList
# getAllowedProxyChains( )

Answer the CAS_ProxyChain_AllowedList object for this client.

public boolean
# validateCAS20( string & $validate_url, string & $text_response, string & $tree_response, boolean $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

private boolean
# _readExtraAttributesCas20( string $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.

private
# _addAttributeToArray( array & $attributeArray, string $name, string $value )

Add an attribute value to an array of attributes.

public
# setURL( string $url )

This method sets the URL of the current request

public The
# getURL( )

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

public string
# setBaseURL( string $url )

This method sets the base URL of the CAS server.

private string
# _getClientUrl( )

Try to figure out the phpCas client URL with possible Proxys / Ports etc.

private boolean
# _isHttps( )

This method checks to see if the request is secured via HTTPS

private string
# _removeParameterFromQueryString( string $parameterName, string $queryString )

Removes a parameter from a query string

private url
# _buildQueryUrl( string $url, string $query )

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

private
# _renameSession( string $ticket )

Renaming the session

private
# _authError( string $failure, string $cas_url, boolean $no_response, boolean $bad_response = '', string $cas_response = '', integer $err_code = '', string $err_msg = '' )

This method is used to print the HTML output when the user was not authenticated.

private string
# _getNodeType( String $nodeURL )

Determine the node type from the URL.

public
# addRebroadcastNode( string $rebroadcastNodeUrl )

Store the rebroadcast node for pgtIou/pgtId and logout requests.

public
# addRebroadcastHeader( string $header )

This method is used to add header parameters when rebroadcasting pgtIou/pgtId or logoutRequest.

private
# _rebroadcast( integer $type )

This method rebroadcasts logout/pgtIou requests. Can be LOGOUT,PGTIOU

Constants summary
integer HOSTNAME

Constants used for determining rebroadcast node type.

# 0
integer IP
# 1
integer LOGOUT

Constants used for determining rebroadcast type (logout or pgtIou/pgtId).

# 0
integer PGTIOU
# 1
Properties summary
private string $_output_header

A string used to print the header of HTML pages. Written by CAS_Client::setHTMLHeader(), read by CAS_Client::printHTMLHeader().

# ''
private $_lang

A string corresponding to the language used by phpCAS. Written by CAS_Client::setLang(), read by CAS_Client::getLang().

# PHPCAS_LANG_DEFAULT
private array $_server

a record to store information about the CAS server. - $_server['version']: the version of the CAS server - $_server['hostname']: the hostname of the CAS server - $_server['port']: the port the CAS server is running on - $_server['uri']: the base URI the CAS server is responding on - $_server['base_url']: the base URL of the CAS server - $_server['login_url']: the login URL of the CAS server - $_server['service_validate_url']: the service validating URL of the CAS server - $_server['proxy_url']: the proxy URL of the CAS server - $_server['proxy_validate_url']: the proxy validating URL of the CAS server - $_server['logout_url']: the logout URL of the CAS server

# array( 'version' => -1, 'hostname' => 'none', 'port' => -1, 'uri' => 'none')
private array $_curl_options

An array to store extra curl options.

# array()
private string $_requestImplementation

The class to instantiate for making web requests in readUrl(). The class specified must implement the CAS_Request_RequestInterface. By default CAS_Request_CurlRequest is used, but this may be overridden to supply alternate request mechanisms for testing.

# 'CAS_Request_CurlRequest'
private boolean $_clearTicketsFromUrl

$_clearTicketsFromUrl; If true, phpCAS will clear session tickets from the URL after a successful authentication.

# true
private callable $_casAttributeParserCallbackFunction

$_attributeParserCallbackFunction;

# null
private array $_casAttributeParserCallbackArgs

$_attributeParserCallbackArgs;

# array()
private callable $_postAuthenticateCallbackFunction

$_postAuthenticateCallbackFunction;

# null
private array $_postAuthenticateCallbackArgs

$_postAuthenticateCallbackArgs;

# array()
private callable $_signoutCallbackFunction

$_signoutCallbackFunction;

# null
private array $_signoutCallbackArgs

$_signoutCallbackArgs;

# array()
private $_authentication_caller
private boolean $_change_session_id

A variable to whether phpcas will use its own session handling. Default = true

# true
private string $_user

The Authenticated user. Written by CAS_Client::_setUser(), read by CAS_Client::getUser().

# ''
private array $_attributes

The Authenticated users attributes. Written by CAS_Client::setAttributes(), read by CAS_Client::getAttributes().

# array()
private integer $_cache_times_for_auth_recheck

An integer that gives the number of times authentication will be cached before rechecked.

# 0
private string $_ticket

The Ticket provided in the URL of the request if present (empty otherwise). Written by CAS_Client::CAS_Client(), read by CAS_Client::getTicket() and CAS_Client::_hasPGT().

# ''
private $_cas_server_ca_cert

the certificate of the CAS server CA.

# null
private boolean $_cas_server_cn_validate

validate CN of the CAS server certificate

# true
private boolean $_no_cas_server_validation

Set to true not to validate the CAS server.

# false
private $_proxy

A boolean telling if the client is a CAS proxy or not. Written by CAS_Client::CAS_Client(), read by CAS_Client::isProxy().

private $_serviceCookieJar

Handler for managing service cookies.

private string $_pgt

the Proxy Grnting Ticket given by the CAS server (empty otherwise). Written by CAS_Client::_setPGT(), read by CAS_Client::_getPGT() and CAS_Client::_hasPGT().

# ''
private boolean $_callback_mode

a boolean to know if the CAS client is running in callback mode. Written by CAS_Client::setCallBackMode(), read by CAS_Client::_isCallbackMode().

# false
private string $_callback_url

the URL that should be used for the PGT callback (in fact the URL of the current request without any CGI parameter). Written and read by CAS_Client::_getCallbackURL().

# ''
private $_pgt_storage

an instance of a class inheriting of PGTStorage, used to deal with PGT storage. Created by CAS_Client::setPGTStorageFile(), used by CAS_Client::setPGTStorageFile() and CAS_Client::_initPGTStorage().

# null
private array $_proxies

This array will store a list of proxies in front of this application. This property will only be populated if this script is being proxied rather than accessed directly.

# array()
private CAS_ProxyChain_AllowedList $_allowed_proxy_chains

A container of patterns to be allowed as proxies in front of the cas client.

private string $_url

the URL of the current request (without any ticket CGI parameter). Written and read by CAS_Client::getURL().

# ''
private boolean $_rebroadcast

Boolean of whether to rebroadcast pgtIou/pgtId and logoutRequest, and array of the nodes.

# false
private array $_rebroadcast_nodes
# array()
private array $_rebroadcast_headers

An array to store extra rebroadcast curl options.

# array()
 

© 2004-2018 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy