ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Internal behaviour of phpCAS
+ Collaboration diagram for Internal behaviour of phpCAS:

Functions

 CAS_Client::setRequestImplementation ($className)
 Override the default implementation used to make web requests in readUrl(). More...
 
 CAS_Client::setNoClearTicketsFromUrl ()
 Configure the client to not send redirect headers and call exit() on authentication success. More...
 
 CAS_Client::setCasAttributeParserCallback ($function, array $additionalArgs=array())
 Set a callback function to be run when parsing CAS attributes. More...
 
 CAS_Client::setPostAuthenticateCallback ($function, array $additionalArgs=array())
 Set a callback function to be run when a user authenticates. More...
 
 CAS_Client::setSingleSignoutCallback ($function, array $additionalArgs=array())
 Set a callback function to be run when a single-signout request is received. More...
 
 CAS_Client::ensureIsProxy ()
 Ensure that this is actually a proxy object or fail with an exception. More...
 
 CAS_Client::markAuthenticationCall ($auth)
 Mark the caller of authentication. More...
 
 CAS_Client::wasAuthenticationCalled ()
 Answer true if authentication has been checked. More...
 
 CAS_Client::_ensureAuthenticationCalled ()
 Ensure that authentication was checked. More...
 
 CAS_Client::wasAuthenticationCallSuccessful ()
 Answer the result of the authentication call. More...
 
 CAS_Client::ensureAuthenticationCallSuccessful ()
 Ensure that authentication was checked. More...
 
 CAS_Client::getAuthenticationCallerFile ()
 Answer information about the authentication caller. More...
 
 CAS_Client::getAuthenticationCallerLine ()
 Answer information about the authentication caller. More...
 
 CAS_Client::getAuthenticationCallerMethod ()
 Answer information about the authentication caller. More...
 

Variables

 CAS_Client::$_requestImplementation = 'CAS_Request_CurlRequest'
 The class to instantiate for making web requests in readUrl(). More...
 
 CAS_Client::$_clearTicketsFromUrl = true
 
 CAS_Client::$_casAttributeParserCallbackFunction = null
 
 CAS_Client::$_casAttributeParserCallbackArgs = array()
 
 CAS_Client::$_postAuthenticateCallbackFunction = null
 
 CAS_Client::$_postAuthenticateCallbackArgs = array()
 
 CAS_Client::$_signoutCallbackFunction = null
 
 CAS_Client::$_signoutCallbackArgs = array()
 
 CAS_Client::$_authentication_caller
 

Detailed Description

Function Documentation

◆ _ensureAuthenticationCalled()

CAS_Client::_ensureAuthenticationCalled ( )
private

Ensure that authentication was checked.

Terminate with exception if no authentication was performed

Exceptions
CAS_OutOfSequenceBeforeAuthenticationCallException
Returns
void

Definition at line 801 of file Client.php.

References CAS_Client\wasAuthenticationCalled().

Referenced by CAS_Client\ensureAuthenticationCallSuccessful(), CAS_Client\getAuthenticationCallerFile(), CAS_Client\getAuthenticationCallerLine(), CAS_Client\getAuthenticationCallerMethod(), and CAS_Client\wasAuthenticationCallSuccessful().

802  {
803  if (!$this->wasAuthenticationCalled()) {
805  }
806  }
wasAuthenticationCalled()
Answer true if authentication has been checked.
Definition: Client.php:788
This class defines Exceptions that should be thrown when the sequence of operations is invalid...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureAuthenticationCallSuccessful()

CAS_Client::ensureAuthenticationCallSuccessful ( )

Ensure that authentication was checked.

Terminate with exception if no authentication was performed

Exceptions
CAS_OutOfSequenceBeforeAuthenticationCallException
Returns
void

Definition at line 831 of file Client.php.

References CAS_Client\_ensureAuthenticationCalled(), CAS_Client\getAuthenticationCallerFile(), CAS_Client\getAuthenticationCallerLine(), and CAS_Client\getAuthenticationCallerMethod().

Referenced by CAS_Client\getAttribute(), CAS_Client\getAttributes(), CAS_Client\getProxiedService(), CAS_Client\getUser(), CAS_Client\hasAttribute(), CAS_Client\hasAttributes(), CAS_Client\initializeProxiedService(), CAS_Client\serviceMail(), and CAS_Client\serviceWeb().

832  {
834  if (!$this->_authentication_caller['result']) {
835  throw new CAS_OutOfSequenceException(
836  'authentication was checked (by '
838  . '() at ' . $this->getAuthenticationCallerFile()
839  . ':' . $this->getAuthenticationCallerLine()
840  . ') but the method returned false'
841  );
842  }
843  }
getAuthenticationCallerFile()
Answer information about the authentication caller.
Definition: Client.php:853
_ensureAuthenticationCalled()
Ensure that authentication was checked.
Definition: Client.php:801
This class defines Exceptions that should be thrown when the sequence of operations is invalid...
getAuthenticationCallerLine()
Answer information about the authentication caller.
Definition: Client.php:867
getAuthenticationCallerMethod()
Answer information about the authentication caller.
Definition: Client.php:881
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureIsProxy()

CAS_Client::ensureIsProxy ( )

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

Exceptions
CAS_OutOfSequenceBeforeProxyException
Returns
void

Definition at line 754 of file Client.php.

References CAS_Client\isProxy().

Referenced by CAS_Client\getProxiedService(), CAS_Client\initializeProxiedService(), CAS_Client\serviceMail(), CAS_Client\serviceWeb(), CAS_Client\setCallbackURL(), CAS_Client\setPGTStorage(), CAS_Client\setPGTStorageDb(), and CAS_Client\setPGTStorageFile().

755  {
756  if (!$this->isProxy()) {
758  }
759  }
isProxy()
Tells if a CAS client is a CAS proxy or not.
Definition: Client.php:2302
This class defines Exceptions that should be thrown when the sequence of operations is invalid...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAuthenticationCallerFile()

CAS_Client::getAuthenticationCallerFile ( )

Answer information about the authentication caller.

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

Returns
array Keys are 'file', 'line', and 'method'

Definition at line 853 of file Client.php.

References CAS_Client\_ensureAuthenticationCalled().

Referenced by CAS_Client\ensureAuthenticationCallSuccessful().

854  {
856  return $this->_authentication_caller['file'];
857  }
_ensureAuthenticationCalled()
Ensure that authentication was checked.
Definition: Client.php:801
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAuthenticationCallerLine()

CAS_Client::getAuthenticationCallerLine ( )

Answer information about the authentication caller.

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

Returns
array Keys are 'file', 'line', and 'method'

Definition at line 867 of file Client.php.

References CAS_Client\_ensureAuthenticationCalled().

Referenced by CAS_Client\ensureAuthenticationCallSuccessful().

868  {
870  return $this->_authentication_caller['line'];
871  }
_ensureAuthenticationCalled()
Ensure that authentication was checked.
Definition: Client.php:801
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAuthenticationCallerMethod()

CAS_Client::getAuthenticationCallerMethod ( )

Answer information about the authentication caller.

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

Returns
array Keys are 'file', 'line', and 'method'

Definition at line 881 of file Client.php.

References CAS_Client\_ensureAuthenticationCalled().

Referenced by CAS_Client\ensureAuthenticationCallSuccessful().

882  {
884  return $this->_authentication_caller['method'];
885  }
_ensureAuthenticationCalled()
Ensure that authentication was checked.
Definition: Client.php:801
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markAuthenticationCall()

CAS_Client::markAuthenticationCall (   $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.

Parameters
bool$authTrue if authentication was successful, false otherwise.
Returns
null

Definition at line 770 of file Client.php.

References $auth.

Referenced by CAS_Client\isAuthenticated().

771  {
772  // store where the authentication has been checked and the result
773  $dbg = debug_backtrace();
774  $this->_authentication_caller = array(
775  'file' => $dbg[1]['file'],
776  'line' => $dbg[1]['line'],
777  'method' => $dbg[1]['class'] . '::' . $dbg[1]['function'],
778  'result' => (boolean) $auth
779  );
780  }
$auth
Definition: fileserver.php:48
+ Here is the caller graph for this function:

◆ setCasAttributeParserCallback()

CAS_Client::setCasAttributeParserCallback (   $function,
array  $additionalArgs = array() 
)

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.

Parameters
string$functioncallback function to call
array$additionalArgsoptional array of arguments
Returns
void

Definition at line 673 of file Client.php.

674  {
675  $this->_casAttributeParserCallbackFunction = $function;
676  $this->_casAttributeParserCallbackArgs = $additionalArgs;
677  }

◆ setNoClearTicketsFromUrl()

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

Needed for testing authentication

Returns
void

Definition at line 647 of file Client.php.

Referenced by CAS_Client\_setProxies().

648  {
649  $this->_clearTicketsFromUrl = false;
650  }
+ Here is the caller graph for this function:

◆ setPostAuthenticateCallback()

CAS_Client::setPostAuthenticateCallback (   $function,
array  $additionalArgs = array() 
)

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.

Parameters
string$functioncallback function to call
array$additionalArgsoptional array of arguments
Returns
void

Definition at line 707 of file Client.php.

708  {
709  $this->_postAuthenticateCallbackFunction = $function;
710  $this->_postAuthenticateCallbackArgs = $additionalArgs;
711  }

◆ setRequestImplementation()

CAS_Client::setRequestImplementation (   $className)

Override the default implementation used to make web requests in readUrl().

This class must implement the CAS_Request_RequestInterface.

Parameters
string$classNamename of the RequestImplementation class
Returns
void

Definition at line 620 of file Client.php.

621  {
622  $obj = new $className;
623  if (!($obj instanceof CAS_Request_RequestInterface)) {
625  '$className must implement the CAS_Request_RequestInterface'
626  );
627  }
628  $this->_requestImplementation = $className;
629  }
This interface defines a class library for performing web requests.
Exception that denotes invalid arguments were passed.

◆ setSingleSignoutCallback()

CAS_Client::setSingleSignoutCallback (   $function,
array  $additionalArgs = array() 
)

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).

Parameters
string$functioncallback function to call
array$additionalArgsoptional array of arguments
Returns
void

Definition at line 737 of file Client.php.

738  {
739  $this->_signoutCallbackFunction = $function;
740  $this->_signoutCallbackArgs = $additionalArgs;
741  }

◆ wasAuthenticationCalled()

CAS_Client::wasAuthenticationCalled ( )

Answer true if authentication has been checked.

Returns
bool

Definition at line 788 of file Client.php.

Referenced by CAS_Client\_ensureAuthenticationCalled().

789  {
790  return !empty($this->_authentication_caller);
791  }
+ Here is the caller graph for this function:

◆ wasAuthenticationCallSuccessful()

CAS_Client::wasAuthenticationCallSuccessful ( )

Answer the result of the authentication call.

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

Returns
bool

Definition at line 816 of file Client.php.

References CAS_Client\_ensureAuthenticationCalled().

817  {
819  return $this->_authentication_caller['result'];
820  }
_ensureAuthenticationCalled()
Ensure that authentication was checked.
Definition: Client.php:801
+ Here is the call graph for this function:

Variable Documentation

◆ $_authentication_caller

CAS_Client::$_authentication_caller
private

Definition at line 781 of file Client.php.

◆ $_casAttributeParserCallbackArgs

CAS_Client::$_casAttributeParserCallbackArgs = array()
private

Definition at line 660 of file Client.php.

◆ $_casAttributeParserCallbackFunction

CAS_Client::$_casAttributeParserCallbackFunction = null
private

Definition at line 655 of file Client.php.

◆ $_clearTicketsFromUrl

CAS_Client::$_clearTicketsFromUrl = true
private

Definition at line 635 of file Client.php.

◆ $_postAuthenticateCallbackArgs

array CAS_Client::$_postAuthenticateCallbackArgs = array()
private

Definition at line 686 of file Client.php.

◆ $_postAuthenticateCallbackFunction

callback CAS_Client::$_postAuthenticateCallbackFunction = null
private

Definition at line 681 of file Client.php.

◆ $_requestImplementation

CAS_Client::$_requestImplementation = 'CAS_Request_CurlRequest'
private

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.

Definition at line 610 of file Client.php.

Referenced by CAS_Client\_readURL(), CAS_Client\_rebroadcast(), and CAS_Client\getProxiedService().

◆ $_signoutCallbackArgs

array CAS_Client::$_signoutCallbackArgs = array()
private

Definition at line 721 of file Client.php.

Referenced by CAS_Client\handleLogoutRequests().

◆ $_signoutCallbackFunction

callback CAS_Client::$_signoutCallbackFunction = null
private

Definition at line 716 of file Client.php.