phpCAS  version 1.4.0
Functions | Variables
Authentication

Functions

 CAS_Client::_setUser ($user)
 
 CAS_Client::getUser ()
 
 CAS_Client::_getUser ()
 
 CAS_Client::setAttributes ($attributes)
 
 CAS_Client::getAttributes ()
 
 CAS_Client::hasAttributes ()
 
 CAS_Client::hasAttribute ($key)
 
 CAS_Client::_hasAttribute ($key)
 
 CAS_Client::getAttribute ($key)
 
 CAS_Client::renewAuthentication ()
 
 CAS_Client::forceAuthentication ()
 
 CAS_Client::setCacheTimesForAuthRecheck ($n)
 
 CAS_Client::checkAuthentication ()
 
 CAS_Client::isAuthenticated ($renew=false)
 
 CAS_Client::isSessionAuthenticated ()
 
 CAS_Client::_wasPreviouslyAuthenticated ()
 
 CAS_Client::redirectToCas ($gateway=false, $renew=false)
 
 CAS_Client::logout ($params)
 
 CAS_Client::_isLogoutRequest ()
 
 CAS_Client::handleLogoutRequests ($check_client=true, $allowed_clients=array())
 

Variables

 CAS_Client::$_user
 
 CAS_Client::$_attributes
 
 CAS_Client::$_cache_times_for_auth_recheck
 

Detailed Description

Function Documentation

◆ _getUser()

CAS_Client::_getUser ( )
private

This method returns the CAS user's login name.

Returns
string the login name of the authenticated user
Warning
should be called only after CAS_Client::forceAuthentication() or CAS_Client::isAuthenticated(), otherwise halt with an error.

Definition at line 1306 of file Client.php.

References CAS_Client\$_user, and phpCAS\error().

Referenced by CAS_Client\getProxiedService(), CAS_Client\getUser(), and CAS_Client\isAuthenticated().

◆ _hasAttribute()

CAS_Client::_hasAttribute (   $key)
private

Check whether a specific attribute with a name is available

Parameters
string$keyname of attribute
Returns
bool is attribute available

Definition at line 1393 of file Client.php.

Referenced by CAS_Client\getAttribute(), and CAS_Client\hasAttribute().

◆ _isLogoutRequest()

CAS_Client::_isLogoutRequest ( )
private

Check of the current request is a logout request

Returns
bool is logout request.

Definition at line 1884 of file Client.php.

Referenced by CAS_Client\__construct(), and CAS_Client\handleLogoutRequests().

◆ _setUser()

CAS_Client::_setUser (   $user)
private

This method sets the CAS user's login name.

Parameters
string$userthe login name of the authenticated user.
Returns
void

Definition at line 1277 of file Client.php.

Referenced by CAS_Client\_wasPreviouslyAuthenticated(), and CAS_Client\validateSA().

◆ _wasPreviouslyAuthenticated()

CAS_Client::_wasPreviouslyAuthenticated ( )
private

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

Note
This function switches to callback mode when needed.
Returns
bool true when the user has already been authenticated; false otherwise.

Definition at line 1713 of file Client.php.

References $auth, CAS_Client\_callback(), CAS_Client\_isCallbackMode(), CAS_Client\_rebroadcast(), CAS_Client\_setPGT(), CAS_Client\_setProxies(), CAS_Client\_setUser(), CAS_Client\clearSessionValues(), CAS_Client\getSessionValue(), CAS_Client\hasSessionValue(), CAS_Client\isProxy(), CAS_Client\isSessionAuthenticated(), CAS_Client\setAttributes(), CAS_Client\setTicket(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_Client\isAuthenticated().

◆ checkAuthentication()

CAS_Client::checkAuthentication ( )

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

Returns
bool true when the user is authenticated, false when a previous gateway login failed or the function will not return if the user is redirected to the cas server for a gateway login attempt

Definition at line 1495 of file Client.php.

References CAS_Client\getSessionValue(), CAS_Client\isAuthenticated(), CAS_Client\redirectToCas(), CAS_Client\removeSessionValue(), CAS_Client\setSessionValue(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

◆ forceAuthentication()

CAS_Client::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.

Returns
bool true when the user is authenticated; otherwise halt.

Definition at line 1446 of file Client.php.

References CAS_Client\isAuthenticated(), CAS_Client\redirectToCas(), CAS_Client\removeSessionValue(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

◆ getAttribute()

CAS_Client::getAttribute (   $key)

Get a specific attribute by name

Parameters
string$keyname of attribute
Returns
string attribute values

Definition at line 1406 of file Client.php.

References CAS_Client\_hasAttribute(), and CAS_Client\ensureAuthenticationCallSuccessful().

◆ getAttributes()

CAS_Client::getAttributes ( )

Get an key values arry of attributes

Returns
array of attributes

Definition at line 1344 of file Client.php.

References CAS_Client\$_attributes, CAS_Client\ensureAuthenticationCallSuccessful(), and phpCAS\error().

◆ getUser()

CAS_Client::getUser ( )

This method returns the CAS user's login name.

Returns
string the login name of the authenticated user
Warning
should be called only after CAS_Client::forceAuthentication() or CAS_Client::isAuthenticated(), otherwise halt with an error.

Definition at line 1290 of file Client.php.

References CAS_Client\_getUser(), and CAS_Client\ensureAuthenticationCallSuccessful().

◆ handleLogoutRequests()

CAS_Client::handleLogoutRequests (   $check_client = true,
  $allowed_clients = array() 
)

This method handles logout requests.

Parameters
bool$check_clienttrue to check the client bofore handling the request, false not to perform any access control. True by default.
array$allowed_clientsan array of host names allowed to send logout requests.
Returns
void

Definition at line 1899 of file Client.php.

References CAS_Client\$_signoutCallbackArgs, $client, CAS_Client\_getServerHostname(), CAS_Client\_isLogoutRequest(), CAS_Client\_rebroadcast(), CAS_Client\_sessionIdForTicket(), phpCAS\error(), CAS_Client\getChangeSessionID(), phpCAS\trace(), phpCAS\traceBegin(), phpCAS\traceEnd(), and phpCAS\traceExit().

◆ hasAttribute()

CAS_Client::hasAttribute (   $key)

Check whether a specific attribute with a name is available

Parameters
string$keyname of attribute
Returns
bool is attribute available

Definition at line 1378 of file Client.php.

References CAS_Client\_hasAttribute(), and CAS_Client\ensureAuthenticationCallSuccessful().

◆ hasAttributes()

CAS_Client::hasAttributes ( )

Check whether attributes are available

Returns
bool attributes available

Definition at line 1364 of file Client.php.

References CAS_Client\ensureAuthenticationCallSuccessful().

◆ isAuthenticated()

CAS_Client::isAuthenticated (   $renew = false)

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

Parameters
bool$renewtrue to force the authentication with the CAS server
Returns
bool true when the user is authenticated. Also may redirect to the same URL without the ticket.

Definition at line 1552 of file Client.php.

References CAS_Client\_getPGT(), CAS_Client\_getUser(), CAS_Client\_validatePGT(), CAS_Client\_wasPreviouslyAuthenticated(), CAS_VERSION_1_0, CAS_VERSION_2_0, CAS_VERSION_3_0, CAS_Client\getServerVersion(), CAS_Client\getTicket(), CAS_Client\getURL(), CAS_Client\hasTicket(), CAS_Client\isProxy(), CAS_Client\markAuthenticationCall(), CAS_Client\setSessionValue(), phpCAS\trace(), phpCAS\traceBegin(), phpCAS\traceEnd(), phpCAS\traceExit(), and CAS_Client\validateSA().

Referenced by CAS_Client\checkAuthentication(), CAS_Client\forceAuthentication(), and CAS_Client\renewAuthentication().

◆ isSessionAuthenticated()

CAS_Client::isSessionAuthenticated ( )

This method tells if the current session is authenticated.

Returns
bool true if authenticated based soley on $_SESSION variable

Definition at line 1700 of file Client.php.

References CAS_Client\getSessionValue().

Referenced by CAS_Client\__construct(), and CAS_Client\_wasPreviouslyAuthenticated().

◆ logout()

CAS_Client::logout (   $params)

This method is used to logout from CAS.

Parameters
array$paramsan array that contains the optional url and service parameters that will be passed to the CAS server
Returns
void

Definition at line 1845 of file Client.php.

References $cas_url, phpCAS\error(), CAS_Client\getLangObj(), CAS_Client\getServerLogoutURL(), CAS_Client\printHTMLFooter(), CAS_Client\printHTMLHeader(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceExit().

◆ redirectToCas()

CAS_Client::redirectToCas (   $gateway = false,
  $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().

Parameters
bool$gatewaytrue to check authentication, false to force it
bool$renewtrue to force the authentication with the CAS server
Returns
void

Definition at line 1817 of file Client.php.

References $cas_url, CAS_Client\getLangObj(), CAS_Client\getServerLoginURL(), CAS_Client\printHTMLFooter(), CAS_Client\printHTMLHeader(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceExit().

Referenced by CAS_Client\checkAuthentication(), CAS_Client\forceAuthentication(), and CAS_Client\renewAuthentication().

◆ renewAuthentication()

CAS_Client::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

Returns
bool true when the user is authenticated; otherwise halt.

Definition at line 1423 of file Client.php.

References CAS_Client\isAuthenticated(), CAS_Client\redirectToCas(), CAS_Client\removeSessionValue(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

◆ setAttributes()

CAS_Client::setAttributes (   $attributes)

Set an array of attributes

Parameters
array$attributesa key value array of attributes
Returns
void

Definition at line 1334 of file Client.php.

Referenced by CAS_Client\_readExtraAttributesCas20(), and CAS_Client\_wasPreviouslyAuthenticated().

◆ setCacheTimesForAuthRecheck()

CAS_Client::setCacheTimesForAuthRecheck (   $n)

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

Parameters
int$nnumber of times to wait for a recheck
Returns
void

Definition at line 1480 of file Client.php.

Variable Documentation

◆ $_attributes

CAS_Client::$_attributes
private

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

Attention
client applications should use phpCAS::getAttributes().

Definition at line 1325 of file Client.php.

Referenced by CAS_Client\getAttributes().

◆ $_cache_times_for_auth_recheck

CAS_Client::$_cache_times_for_auth_recheck
private

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

Definition at line 1471 of file Client.php.

◆ $_user

CAS_Client::$_user
private

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

Definition at line 1268 of file Client.php.

Referenced by CAS_Client\_getUser().