PHP Class Auth_OpenID_SQLStore

The table names used are determined by the class variables associations_table_name and nonces_table_name. To change the name of the tables used, pass new table names into the constructor. To create the tables with the proper schema, see the createTables method. This class shouldn't be used directly. Use one of its subclasses instead, as those contain the code necessary to use a specific database. If you're an OpenID integrator and you'd like to create an SQL-driven store that wraps an application's database abstraction, be sure to create a subclass of {@link Auth_OpenID_DatabaseConnection} that calls the application's database abstraction calls. Then, pass an instance of your new database connection class to your SQLStore subclass constructor. All methods other than the constructor and createTables should be considered implementation details.
Inheritance: extends Auth_OpenID_OpenIDStore
Show file Open project: openid/php-openid Class Usage Examples

Public Methods

Method Description
__construct ( connection $connection, $associations_table = null, $nonces_table = null ) This creates a new SQLStore instance. It requires an established database connection be given to it, and it allows overriding the default table names.
_add_nonce ( $server_url, $timestamp, $salt )
_fixSQL ( )
_get_assoc ( $server_url, $handle )
_get_assocs ( $server_url )
_octify ( $str ) "Octifies" a binary string by returning a string with escaped octal bytes. This is used for preparing binary data for PostgreSQL BYTEA fields.
_set_assoc ( $server_url, $handle, $secret, $issued, $lifetime, $assoc_type )
_unoctify ( $str ) "Unoctifies" octal-escaped data from PostgreSQL and returns the resulting ASCII (possibly binary) string.
_verifySQL ( )
blobDecode ( $blob )
blobEncode ( $str )
cleanupAssociations ( )
cleanupNonces ( )
createTables ( )
create_assoc_table ( )
create_nonce_table ( )
getAssociation ( $server_url, $handle = null )
isError ( $value ) Returns true if $value constitutes a database error; returns false otherwise.
removeAssociation ( $server_url, $handle )
reset ( ) Resets the store by removing all records from the store's tables.
resultToBool ( $obj ) Converts a query result to a boolean. If the result is a database error according to $this->isError(), this returns false; otherwise, this returns true.
setSQL ( ) This method should be overridden by subclasses. This method is called by the constructor to set values in $this->sql, which is an array keyed on sql name.
storeAssociation ( $server_url, $association )
tableExists ( $table_name )
useNonce ( $server_url, $timestamp, $salt )

Method Details

__construct() public method

This creates a new SQLStore instance. It requires an established database connection be given to it, and it allows overriding the default table names.
public __construct ( connection $connection, $associations_table = null, $nonces_table = null )
$connection connection This must be an established connection to a database of the correct type for the SQLStore subclass you're using. This must either be an PEAR DB connection handle or an instance of a subclass of Auth_OpenID_DatabaseConnection.

_add_nonce() public method

public _add_nonce ( $server_url, $timestamp, $salt )

_fixSQL() public method

public _fixSQL ( )

_get_assoc() public method

public _get_assoc ( $server_url, $handle )

_get_assocs() public method

public _get_assocs ( $server_url )

_octify() public method

"Octifies" a binary string by returning a string with escaped octal bytes. This is used for preparing binary data for PostgreSQL BYTEA fields.
public _octify ( $str )

_set_assoc() public method

public _set_assoc ( $server_url, $handle, $secret, $issued, $lifetime, $assoc_type )

_unoctify() public method

"Unoctifies" octal-escaped data from PostgreSQL and returns the resulting ASCII (possibly binary) string.
public _unoctify ( $str )

_verifySQL() public method

public _verifySQL ( )

blobDecode() public method

public blobDecode ( $blob )

blobEncode() public method

public blobEncode ( $str )

cleanupAssociations() public method

public cleanupAssociations ( )

cleanupNonces() public method

public cleanupNonces ( )

createTables() public method

public createTables ( )

create_assoc_table() public method

public create_assoc_table ( )

create_nonce_table() public method

public create_nonce_table ( )

getAssociation() public method

public getAssociation ( $server_url, $handle = null )

isError() public method

Returns true if $value constitutes a database error; returns false otherwise.
public isError ( $value )

removeAssociation() public method

public removeAssociation ( $server_url, $handle )

reset() public method

Resets the store by removing all records from the store's tables.
public reset ( )

resultToBool() public method

Converts a query result to a boolean. If the result is a database error according to $this->isError(), this returns false; otherwise, this returns true.
public resultToBool ( $obj )

setSQL() public method

This method should be overridden by subclasses. This method is called by the constructor to set values in $this->sql, which is an array keyed on sql name.
public setSQL ( )

storeAssociation() public method

public storeAssociation ( $server_url, $association )

tableExists() public method

public tableExists ( $table_name )

useNonce() public method

public useNonce ( $server_url, $timestamp, $salt )