JanRain OpenID Library

Auth_OpenID_PredisStore extends Auth_OpenID_OpenIDStore
in package

Supplies Redis server store backend for OpenID servers and consumers.

Uses Predis library https://github.com/nrk/predis. Requires PHP >= 5.3.

Table of Contents

$prefix  : string
Prefix for Redis keys
$redis  : Client
__construct()  : mixed
Initializes a new {@link Auth_OpenID_PredisStore} instance.
associationKey()  : mixed
Key is prefixed with $prefix and 'openid_association_' string
associationServerKey()  : mixed
Key is prefixed with $prefix and 'openid_association_server_' string
cleanup()  : array<string|int, mixed>
Shortcut for cleanupNonces(), cleanupAssociations().
cleanupAssociations()  : int
Remove expired associations from the store.
cleanupNonces()  : int
Remove expired nonces from the store.
getAssociation()  : Auth_OpenID_Association
Read association from Redis. If no handle given and multiple associations found, returns latest issued
removeAssociation()  : mixed
Immediately delete association from Redis.
reset()  : mixed
Removes all entries from the store; implementation is optional.
storeAssociation()  : mixed
Store association until its expiration time in Redis server.
supportsCleanup()  : mixed
Report that this storage doesn't support cleanup
useNonce()  : bool
Create nonce for server and salt, expiring after $Auth_OpenID_SKEW seconds.
getAssociationFromServer()  : mixed
Function to actually receive and unserialize the association from the server.
nonceKey()  : mixed
Build up nonce key

Properties

$prefix

Prefix for Redis keys

protected string $prefix

Methods

__construct()

Initializes a new {@link Auth_OpenID_PredisStore} instance.

public __construct(Client $redis[, string $prefix = '' ]) : mixed
Parameters
$redis : Client

Predis client object

$prefix : string = ''

Prefix for all keys stored to the Redis

Return values
mixed

associationKey()

Key is prefixed with $prefix and 'openid_association_' string

public associationKey(mixed $server_url[, mixed $handle = null ]) : mixed
Parameters
$server_url : mixed
$handle : mixed = null
Return values
mixed

associationServerKey()

Key is prefixed with $prefix and 'openid_association_server_' string

public associationServerKey(mixed $server_url) : mixed
Parameters
$server_url : mixed
Return values
mixed

cleanup()

Shortcut for cleanupNonces(), cleanupAssociations().

public cleanup() : array<string|int, mixed>

This method is not called in the normal operation of the library. It provides a way for store admins to keep their storage from filling up with expired data.

Return values
array<string|int, mixed>

cleanupAssociations()

Remove expired associations from the store.

public cleanupAssociations() : int

This method is not called in the normal operation of the library. It provides a way for store admins to keep their storage from filling up with expired data.

Return values
int

the number of associations expired.

cleanupNonces()

Remove expired nonces from the store.

public cleanupNonces() : int

Discards any nonce from storage that is old enough that its timestamp would not pass useNonce().

This method is not called in the normal operation of the library. It provides a way for store admins to keep their storage from filling up with expired data.

Return values
int

the number of nonces expired

getAssociation()

Read association from Redis. If no handle given and multiple associations found, returns latest issued

public getAssociation(mixed $server_url[, mixed $handle = null ]) : Auth_OpenID_Association
Parameters
$server_url : mixed

The URL of the identity server to get the association for. Because of the way the server portion of the library uses this interface, don't assume there are any limitations on the character set of the input string. In particular, expect to see unescaped non-url-safe characters in the server_url field.

$handle : mixed = null

This optional parameter is the handle of the specific association to get. If no specific handle is provided, any valid association matching the server URL is returned.

Return values
Auth_OpenID_Association

The Association for the given identity server.

removeAssociation()

Immediately delete association from Redis.

public removeAssociation(mixed $server_url, mixed $handle) : mixed
Parameters
$server_url : mixed

The URL of the identity server the association to remove belongs to. Because of the way the server portion of the library uses this interface, don't assume there are any limitations on the character set of the input string. In particular, expect to see unescaped non-url-safe characters in the server_url field.

$handle : mixed

This is the handle of the association to remove. If there isn't an association found that matches both the given URL and handle, then there was no matching handle found.

Return values
mixed

Returns whether or not the given association existed.

reset()

Removes all entries from the store; implementation is optional.

public reset() : mixed
Return values
mixed

storeAssociation()

Store association until its expiration time in Redis server.

public storeAssociation(mixed $server_url, mixed $association) : mixed

Overwrites any existing association with same server_url and handle. Handles list of associations for every server.

Parameters
$server_url : mixed

The URL of the identity server that this association is with. Because of the way the server portion of the library uses this interface, don't assume there are any limitations on the character set of the input string. In particular, expect to see unescaped non-url-safe characters in the server_url field.

$association : mixed

The Association to store.

Return values
mixed

supportsCleanup()

Report that this storage doesn't support cleanup

public supportsCleanup() : mixed
Return values
mixed

useNonce()

Create nonce for server and salt, expiring after $Auth_OpenID_SKEW seconds.

public useNonce(mixed $server_url, mixed $timestamp, mixed $salt) : bool
Parameters
$server_url : mixed
$timestamp : mixed
$salt : mixed
Return values
bool

Whether or not the nonce was valid.

getAssociationFromServer()

Function to actually receive and unserialize the association from the server.

private getAssociationFromServer(mixed $associationKey) : mixed
Parameters
$associationKey : mixed
Return values
mixed

nonceKey()

Build up nonce key

private nonceKey(mixed $server_url, mixed $salt) : mixed
Parameters
$server_url : mixed
$salt : mixed
Return values
mixed

Search results