Class Horde_Token

Description

The Horde_Token:: class provides a common abstracted interface into the various token generation mediums. It also includes all of the functions for retrieving, storing, and checking tokens.

$Horde: framework/Token/Token.php,v 1.33.6.18 2009/01/06 15:23:44 jan Exp $

Copyright 1999-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Located in /Token/Token.php (line 23)


	
			
Direct descendents
Class Description
 class Horde_Token_file Token tracking implementation for local files.
 class Horde_Token_sql Token tracking implementation for PHP's PEAR database abstraction layer.
Variable Summary
 array $_params
Method Summary
 Horde_Token Horde_Token ([array $params = array()])
 void add ()
 void exists ()
 Horde_Token &factory (mixed $driver, [array $params = array()])
 string generateId ([string $seed = ''])
 void purge ()
 Horde_Token &singleton (mixed $driver, [array $params = array()])
 boolean verify (string $token)
Variables
array $_params = array() (line 30)

Hash of parameters necessary to use the chosen backend.

Methods
Constructor Horde_Token (line 37)

Constructor.

Horde_Token Horde_Token ([array $params = array()])
  • array $params: A hash containing parameters.
add (line 103)

This is an abstract method that should be overridden by a subclass implementation. The base implementation allows all token values.

void add ()

Redefined in descendants as:
encodeRemoteAddress (line 43)
void encodeRemoteAddress ()
exists (line 93)

This is an abstract method that should be overridden by a subclass implementation. The base implementation allows all token values.

void exists ()

Redefined in descendants as:
factory (line 131)

Attempts to return a concrete Horde_Token instance based on $driver.

  • return: The newly created concrete Horde_Token instance, or false an error.
Horde_Token &factory (mixed $driver, [array $params = array()])
  • mixed $driver: The type of concrete Horde_Token subclass to return. If $driver is an array, then we will look in $driver[0]/lib/Token/ for the subclass implementation named $driver[1].php.
  • array $params: A hash containing any additional configuration or connection parameters a subclass might need.
generateId (line 59)

Generates a connection id and returns it.

  • return: The generated id string.
string generateId ([string $seed = ''])
  • string $seed: A unique ID to be included in the token.
purge (line 113)

This is an abstract method that should be overridden by a subclass implementation. The base implementation allows all token values.

void purge ()

Redefined in descendants as:
singleton (line 186)

Attempts to return a reference to a concrete Horde_Token instance based on $driver.

It will only create a new instance if no Horde_Token instance with the same parameters currently exists.

This should be used if multiple types of token generators (and, thus, multiple Horde_Token instances) are required.

This method must be invoked as:

  1. $var &Horde_Token::singleton();

  • return: The concrete Horde_Token reference, or false on error.
Horde_Token &singleton (mixed $driver, [array $params = array()])
  • mixed $driver: The type of concrete Horde_Token subclass to return. If $driver is an array, then we will look in $driver[0]/lib/Token/ for the subclass implementation named $driver[1].php.
  • array $params: A hash containing any additional configuration or connection parameters a subclass might need.
verify (line 75)

Checks if the given token has been previously used. First purges all expired tokens. Then retrieves current tokens for the given ip address. If the specified token was not found, adds it.

  • return: True if the token has not been used, false otherwise.
boolean verify (string $token)
  • string $token: The value of the token to check.

Documentation generated on Sun, 30 Jan 2011 05:22:55 +0000 by phpDocumentor 1.4.3