Auth_OpenID_Association
in package
This class represents an association between a server and a consumer. In general, users of this library will never see instances of this object. The only exception is if you implement a custom {@link Auth_OpenID_OpenIDStore}.
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.
Table of Contents
- $_macs : mixed
- $assoc_keys : mixed
- The ordering and name of keys as stored by serialize.
- $SIG_LENGTH : mixed
- This is a HMAC-SHA1 specific value.
- __construct() : mixed
- This is the standard constructor for creating an association.
- _makePairs() : array<string|int, mixed>|null
- 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() : bool
- Confirm that the signature of these fields matches the signature contained in the data.
- deserialize() : Auth_OpenID_Association
- Parse an association as stored by serialize(). This is the inverse of serialize.
- equal() : bool
- This checks to see if two {@link Auth_OpenID_Association} instances represent the same association.
- fromExpiresIn() : Auth_OpenID_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() : int
- This returns the number of seconds this association is still valid for, or 0 if the association is no longer valid.
- getMessageSignature() : string
- 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() : string
- Generate a signature for a sequence of (key, value) pairs
Properties
$_macs
public
mixed
$_macs
= ['HMAC-SHA1' => 'Auth_OpenID_HMACSHA1', 'HMAC-SHA256' => 'Auth_OpenID_HMACSHA256']
$assoc_keys
The ordering and name of keys as stored by serialize.
public
mixed
$assoc_keys
= ['version', 'handle', 'secret', 'issued', 'lifetime', 'assoc_type']
Tags
$SIG_LENGTH
This is a HMAC-SHA1 specific value.
public
mixed
$SIG_LENGTH
= 20
Tags
Methods
__construct()
This is the standard constructor for creating an association.
public
__construct(string $handle, string $secret, int $issued, int $lifetime, string $assoc_type) : mixed
The library should create all of the necessary associations, so this constructor is not part of the external API.
Parameters
- $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 : int
-
This is the time this association was issued, in seconds since 00:00 GMT, January 1, 1970. (ie, a unix timestamp)
- $lifetime : int
-
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.
Tags
Return values
mixed —_makePairs()
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(Auth_OpenID_Message $message) : array<string|int, mixed>|null
Parameters
- $message : Auth_OpenID_Message
Tags
Return values
array<string|int, mixed>|null —checkMessageSignature()
Confirm that the signature of these fields matches the signature contained in the data.
public
checkMessageSignature(Auth_OpenID_Message $message) : bool
Parameters
- $message : Auth_OpenID_Message
Tags
Return values
bool —deserialize()
Parse an association as stored by serialize(). This is the inverse of serialize.
public
static deserialize(string $class_name, string $assoc_s) : Auth_OpenID_Association
Parameters
- $class_name : string
- $assoc_s : string
-
Association as serialized by serialize()
Return values
Auth_OpenID_Association —$result instance of this class
equal()
This checks to see if two {@link Auth_OpenID_Association} instances represent the same association.
public
equal(object $other) : bool
Parameters
- $other : object
Return values
bool —$result true if the two instances represent the same association, false otherwise.
fromExpiresIn()
This is an alternate constructor (factory method) used by the OpenID consumer library to create associations. OpenID store implementations shouldn't use this constructor.
public
static fromExpiresIn(int $expires_in, string $handle, string $secret, string $assoc_type) : Auth_OpenID_Association
Parameters
- $expires_in : int
-
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.
- $secret : string
-
This is the shared secret the server generated for this association.
- $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.
Tags
Return values
Auth_OpenID_Association —getExpiresIn()
This returns the number of seconds this association is still valid for, or 0 if the association is no longer valid.
public
getExpiresIn([int|null $now = null ]) : int
Parameters
- $now : int|null = null
Return values
int —$seconds The number of seconds this association is still valid for, or 0 if the association is no longer valid.
getMessageSignature()
Given an {@link Auth_OpenID_Message}, return the signature for the signed list in the message.
public
getMessageSignature(Auth_OpenID_Message $message) : string
Parameters
- $message : Auth_OpenID_Message
Tags
Return values
string —serialize()
Convert an association to KV form.
public
serialize() : string
Return values
string —$result String in KV form suitable for deserialization by deserialize.
sign()
Generate a signature for a sequence of (key, value) pairs
public
sign(array<string|int, mixed> $pairs) : string
Parameters
- $pairs : array<string|int, mixed>
-
The pairs to sign, in order. This is an array of two-tuples.
Tags
Return values
string —$signature The binary signature of this sequence of pairs