phpCAS version 1.3.6

Modules | Namespaces | Functions | Variables
PGT storage
Implementation » CAS Proxy features (CAS 2.0, Proxy Granting Tickets)

## Modules
| PGT storage in a database
| PGT storage on the filesystem

## Namespaces
| PhpCAS

## Functions
| CAS_Client::_initPGTStorage ()
| CAS_Client::_storePGT ($pgt, $pgt_iou)
| CAS_Client::_loadPGT ($pgt_iou)
| CAS_Client::setPGTStorage ($storage)
| CAS_Client::setPGTStorageDb ( $dsn_or_pdo, $username='', $password='', $table='', $driver_options=null)
| CAS_Client::setPGTStorageFile ($path='')
| CAS_Client::_validatePGT (&$validate_url, $text_response, $tree_response)
| CAS_Client::retrievePT ($target_service, &$err_code, &$err_msg)
| CAS_PGTStorage_AbstractStorage::__construct ($cas_parent)
| CAS_PGTStorage_AbstractStorage::getStorageType ()
| CAS_PGTStorage_AbstractStorage::getStorageInfo ()
| CAS_PGTStorage_AbstractStorage::setErrorMessage ($error_message)
| CAS_PGTStorage_AbstractStorage::getErrorMessage ()
| CAS_PGTStorage_AbstractStorage::isInitialized ()
| CAS_PGTStorage_AbstractStorage::init ()
| CAS_PGTStorage_AbstractStorage::write ($pgt, $pgt_iou)
| CAS_PGTStorage_AbstractStorage::read ($pgt_iou)

## Variables
| CAS_Client::$_pgt_storage
| CAS_PGTStorage_AbstractStorage::$_error_message
| CAS_PGTStorage_AbstractStorage::$_initialized

## Detailed Description

## Function Documentation

## ◆ __construct()

CAS_PGTStorage_AbstractStorage::__construct | ( |  | $cas_parent | ) |
| protected

The constructor of the class, should be called only by inherited classes.

Parameters

  CAS_Client | $cas_parent | the CAS _client instance that creates the current object.

Returns
  void

Definition at line 67 of file AbstractStorage.php.

References phpCAS\error(), phpCAS\traceBegin(), and phpCAS\traceEnd().

## ◆ _initPGTStorage()

CAS_Client::_initPGTStorage | ( |  | ) |
| private

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

Returns
  void

Definition at line 2455 of file Client.php.

References CAS_Client\setPGTStorageFile().

Referenced by CAS_Client\_loadPGT(), and CAS_Client\_storePGT().

## ◆ _loadPGT()

CAS_Client::_loadPGT | ( |  | $pgt_iou | ) |
| private

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

Parameters

  string | $pgt_iou | the PGT Iou

Returns
  mul The PGT corresponding to the Iou, false when not found.

Definition at line 2490 of file Client.php.

References CAS_Client\_initPGTStorage().

Referenced by CAS_Client\_validatePGT().

## ◆ _storePGT()

CAS_Client::_storePGT | ( |  | $pgt,
|  |  | $pgt_iou
| ) |  |
| private

This method stores a PGT. Halts on error.

Parameters

  string | $pgt | the PGT to store
  string | $pgt_iou | its corresponding Iou

Returns
  void

Definition at line 2474 of file Client.php.

References CAS_Client\_initPGTStorage().

## ◆ _validatePGT()

CAS_Client::_validatePGT | ( | & | $validate_url,
|  |  | $text_response,
|  |  | $tree_response
| ) |  |
| private

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

Parameters

  string | &$validate_url | the URL of the request to the CAS server.
  string | $text_response | the response of the CAS server, as is (XML text); result of CAS_Client::validateCAS10() or CAS_Client::validateCAS20().
  string | $tree_response | the response of the CAS server, as a DOM XML tree; result of CAS_Client::validateCAS10() or CAS_Client::validateCAS20().

Returns
  bool true when successfull and issue a CAS_AuthenticationException and false on an error

Definition at line 2604 of file Client.php.

References CAS_Client\_loadPGT(), CAS_Client\_setPGT(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_Client\isAuthenticated().

## ◆ getErrorMessage()

CAS_PGTStorage_AbstractStorage::getErrorMessage | ( |  | ) |

This method returns an error message set by PGTStorage::setErrorMessage().

Returns
  an error message when set by PGTStorage::setErrorMessage(), FALSE otherwise.

Deprecated:
  not used.

Definition at line 144 of file AbstractStorage.php.

References CAS_PGTStorage_AbstractStorage\$_error_message.

## ◆ getStorageInfo()

CAS_PGTStorage_AbstractStorage::getStorageInfo | ( |  | ) |

This virtual method returns an informational string giving informations on the parameters of the storage.(used for debugging purposes).

Returns
  void

Definition at line 103 of file AbstractStorage.php.

References phpCAS\error().

## ◆ getStorageType()

CAS_PGTStorage_AbstractStorage::getStorageType | ( |  | ) |

This virtual method returns an informational string giving the type of storage used by the object (used for debugging purposes).

Returns
  void

Definition at line 90 of file AbstractStorage.php.

References phpCAS\error().

## ◆ init()

CAS_PGTStorage_AbstractStorage::init | ( |  | ) |

This virtual method initializes the object.

Returns
  void

Definition at line 178 of file AbstractStorage.php.

## ◆ isInitialized()

CAS_PGTStorage_AbstractStorage::isInitialized | ( |  | ) |
| protected

This method tells if the storage has already been intialized.

Returns
  a boolean

Definition at line 168 of file AbstractStorage.php.

References CAS_PGTStorage_AbstractStorage\$_initialized.

Referenced by CAS_PGTStorage_Db\createTable(), CAS_PGTStorage_File\init(), and CAS_PGTStorage_Db\init().

## ◆ read()

CAS_PGTStorage_AbstractStorage::read | ( |  | $pgt_iou | ) |

This virtual method reads a PGT corresponding to a PGT Iou and deletes the corresponding storage entry.

Parameters

  string | $pgt_iou | the PGT iou

Returns
  void

Note
  Should never be called.

Definition at line 213 of file AbstractStorage.php.

References phpCAS\error().

## ◆ retrievePT()

CAS_Client::retrievePT | ( |  | $target_service,
|  | & | $err_code,
|  | & | $err_msg
| ) |  |

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

Parameters

  string | $target_service | the service to ask for with the PT.
  string | &$err_code | an error code (PHPCAS_SERVICE_OK on success).
  string | &$err_msg | an error message (empty on success).

Returns
  a Proxy Ticket, or false on error.

Definition at line 2658 of file Client.php.

References $cas_url, CAS_Client\_getPGT(), CAS_Client\_readURL(), CAS_Client\getServerProxyURL(), phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceEnd().

Referenced by CAS_Client\initializeProxiedService().

## ◆ setErrorMessage()

CAS_PGTStorage_AbstractStorage::setErrorMessage | ( |  | $error_message | ) |

This method sets en error message, which can be read later by PGTStorage::getErrorMessage().

Parameters

  string | $error_message | an error message

Returns
  void

Deprecated:
  not used.

Definition at line 131 of file AbstractStorage.php.

## ◆ setPGTStorage()

CAS_Client::setPGTStorage | ( |  | $storage | ) |

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

Parameters

  CAS_PGTStorage_AbstractStorage | $storage | a PGT storage object that inherits from the CAS_PGTStorage_AbstractStorage class

Returns
  void

Definition at line 2506 of file Client.php.

References CAS_Client\ensureIsProxy(), and phpCAS\error().

Referenced by CAS_Client\setPGTStorageDb(), and CAS_Client\setPGTStorageFile().

## ◆ setPGTStorageDb()

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

Parameters

  string | $dsn_or_pdo | a dsn string to use for creating a PDO object or a PDO object
  string | $username | the username to use when connecting to the database
  string | $password | the password to use when connecting to the database
  string | $table | the table to use for storing and retrieving PGTs
  string | $driver_options | any driver options to use when connecting to the database

Returns
  void

Definition at line 2541 of file Client.php.

References $driver_options, CAS_Client\ensureIsProxy(), and CAS_Client\setPGTStorage().

## ◆ setPGTStorageFile()

CAS_Client::setPGTStorageFile | ( |  | $path = `''` | ) |

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

Parameters

  string | $path | the path where the PGT's should be stored

Returns
  void

Definition at line 2573 of file Client.php.

References CAS_Client\ensureIsProxy(), and CAS_Client\setPGTStorage().

Referenced by CAS_Client\_initPGTStorage().

## ◆ write()

CAS_PGTStorage_AbstractStorage::write | ( |  | $pgt,
|  |  | $pgt_iou
| ) |  |

This virtual method stores a PGT and its corresponding PGT Iuo.

Parameters

  string | $pgt | the PGT
  string | $pgt_iou | the PGT iou

Returns
  void

Note
  Should never be called.

Definition at line 198 of file AbstractStorage.php.

References phpCAS\error().

## Variable Documentation

## ◆ $_error_message

CAS_PGTStorage_AbstractStorage::$_error_message

string used to store an error message. Written by PGTStorage::setErrorMessage(), read by PGTStorage::getErrorMessage().

Deprecated:
  not used.

Definition at line 119 of file AbstractStorage.php.

Referenced by CAS_PGTStorage_AbstractStorage\getErrorMessage().

## ◆ $_initialized

CAS_PGTStorage_AbstractStorage::$_initialized

a boolean telling if the storage has already been initialized. Written by PGTStorage::init(), read by PGTStorage::isInitialized().

Definition at line 159 of file AbstractStorage.php.

Referenced by CAS_PGTStorage_AbstractStorage\isInitialized().

## ◆ $_pgt_storage

CAS_Client::$_pgt_storage
| private

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

Definition at line 2447 of file Client.php.