phpCAS version 1.3.6

Functions | Variables
Authentication
Implementation

## 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=false)

## 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 1134 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 | $key | name of attribute

Returns
  bool is attribute available

Definition at line 1221 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 1720 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 | $user | the login name of the authenticated user.

Returns
  void

Definition at line 1105 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
  true when the user has already been authenticated; false otherwise.

Definition at line 1549 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\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
  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 1327 of file Client.php.

References CAS_Client\isAuthenticated(), CAS_Client\redirectToCas(), 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
  true when the user is authenticated; otherwise halt.

Definition at line 1276 of file Client.php.

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

## ◆ getAttribute()

CAS_Client::getAttribute | ( |  | $key | ) |

Get a specific attribute by name

Parameters

  string | $key | name of attribute

Returns
  string attribute values

Definition at line 1234 of file Client.php.

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

## ◆ getAttributes()

CAS_Client::getAttributes | ( |  | ) |

Get an key values arry of attributes

Returns
  arry of attributes

Definition at line 1172 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 1118 of file Client.php.

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

## ◆ handleLogoutRequests()

CAS_Client::handleLogoutRequests | ( |  | $check_client = `true`,
|  |  | $allowed_clients = `false`
| ) |  |

This method handles logout requests.

Parameters

  bool | $check_client | true to check the client bofore handling the request, false not to perform any access control. True by default.
  bool | $allowed_clients | an array of host names allowed to send logout requests.

Returns
  void

Definition at line 1735 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 | $key | name of attribute

Returns
  bool is attribute available

Definition at line 1206 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 1192 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 | $renew | true to force the authentication with the CAS server

Returns
  true when the user is authenticated. Also may redirect to the same URL without the ticket.

Definition at line 1388 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(), 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
  true if authenticated based soley on $_SESSION variable

Definition at line 1536 of file Client.php.

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

## ◆ logout()

CAS_Client::logout | ( |  | $params | ) |

This method is used to logout from CAS.

Parameters

  array | $params | an array that contains the optional url and service parameters that will be passed to the CAS server

Returns
  void

Definition at line 1681 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 | $gateway | true to check authentication, false to force it
  bool | $renew | true to force the authentication with the CAS server

Returns
  void

Definition at line 1653 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
  true when the user is authenticated; otherwise halt.

Definition at line 1251 of file Client.php.

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

## ◆ setAttributes()

CAS_Client::setAttributes | ( |  | $attributes | ) |

Set an array of attributes

Parameters

  array | $attributes | a key value array of attributes

Returns
  void

Definition at line 1162 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 | $n | number of times to wait for a recheck

Returns
  void

Definition at line 1312 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 1153 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 1303 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 1096 of file Client.php.

Referenced by CAS_Client\_getUser().