PHP Class Auth_OpenID_Association

If you do implement such a store, it will need to store the values of the handle, secret, issued, lifetime, and assoc_type instance variables.
Show file Open project: openid/php-openid Class Usage Examples

Public Properties

Property Type Description
$SIG_LENGTH This is a HMAC-SHA1 specific value.
$_macs
$assoc_keys The ordering and name of keys as stored by serialize.

Public Methods

Method Description
__construct ( string $handle, string $secret, integer $issued, integer $lifetime, string $assoc_type ) This is the standard constructor for creating an association.
_makePairs ( $message ) Given a {@link Auth_OpenID_Message}, return the key/value pairs to be signed according to the signed list in the message. If the message lacks a signed list, return null.
checkMessageSignature ( $message ) Confirm that the signature of these fields matches the signature contained in the data.
deserialize ( $class_name, string $assoc_s ) : Auth_OpenID_Association Parse an association as stored by serialize(). This is the inverse of serialize.
equal ( $other ) : boolean This checks to see if two {@link Auth_OpenID_Association} instances represent the same association.
fromExpiresIn ( integer $expires_in, string $handle, $secret, $assoc_type ) : association This is an alternate constructor (factory method) used by the OpenID consumer library to create associations. OpenID store implementations shouldn't use this constructor.
getExpiresIn ( $now = null ) : integer This returns the number of seconds this association is still valid for, or 0 if the association is no longer valid.
getMessageSignature ( $message ) Given an {@link Auth_OpenID_Message}, return the signature for the signed list in the message.
serialize ( ) : string Convert an association to KV form.
sign ( array $pairs ) : string Generate a signature for a sequence of (key, value) pairs
signMessage ( $message ) : string Generate a signature for some fields in a dictionary

Method Details

__construct() public method

The library should create all of the necessary associations, so this constructor is not part of the external API.
public __construct ( string $handle, string $secret, integer $issued, integer $lifetime, string $assoc_type )
$handle string This is the handle the server gave this association.
$secret string This is the shared secret the server generated for this association.
$issued integer This is the time this association was issued, in seconds since 00:00 GMT, January 1, 1970. (ie, a unix timestamp)
$lifetime integer This is the amount of time this association is good for, measured in seconds since the association was issued.
$assoc_type string This is the type of association this instance represents. The only valid values of this field at this time is 'HMAC-SHA1' and 'HMAC-SHA256', but new types may be defined in the future.

_makePairs() public method

Given a {@link Auth_OpenID_Message}, return the key/value pairs to be signed according to the signed list in the message. If the message lacks a signed list, return null.
public _makePairs ( $message )

checkMessageSignature() public method

Confirm that the signature of these fields matches the signature contained in the data.
public checkMessageSignature ( $message )

deserialize() static public method

Parse an association as stored by serialize(). This is the inverse of serialize.
static public deserialize ( $class_name, string $assoc_s ) : Auth_OpenID_Association
$assoc_s string Association as serialized by serialize()
return Auth_OpenID_Association $result instance of this class

equal() public method

This checks to see if two {@link Auth_OpenID_Association} instances represent the same association.
public equal ( $other ) : boolean
return boolean $result true if the two instances represent the same association, false otherwise.

fromExpiresIn() static public method

This is an alternate constructor (factory method) used by the OpenID consumer library to create associations. OpenID store implementations shouldn't use this constructor.
static public fromExpiresIn ( integer $expires_in, string $handle, $secret, $assoc_type ) : association
$expires_in integer This is the amount of time this association is good for, measured in seconds since the association was issued.
$handle string This is the handle the server gave this association.
return association An {@link Auth_OpenID_Association} instance.

getExpiresIn() public method

This returns the number of seconds this association is still valid for, or 0 if the association is no longer valid.
public getExpiresIn ( $now = null ) : integer
return integer $seconds The number of seconds this association is still valid for, or 0 if the association is no longer valid.

getMessageSignature() public method

Given an {@link Auth_OpenID_Message}, return the signature for the signed list in the message.
public getMessageSignature ( $message )

serialize() public method

Convert an association to KV form.
public serialize ( ) : string
return string $result String in KV form suitable for deserialization by deserialize.

sign() public method

Generate a signature for a sequence of (key, value) pairs
public sign ( array $pairs ) : string
$pairs array The pairs to sign, in order. This is an array of two-tuples.
return string $signature The binary signature of this sequence of pairs

signMessage() public method

Generate a signature for some fields in a dictionary
public signMessage ( $message ) : string
return string $signature The signature, base64 encoded

Property Details

$SIG_LENGTH public property

This is a HMAC-SHA1 specific value.
public $SIG_LENGTH

$_macs public property

public $_macs

$assoc_keys public property

The ordering and name of keys as stored by serialize.
public $assoc_keys