Auth_OpenID_Association::fromExpiresIn PHP Method

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.
    static function fromExpiresIn($expires_in, $handle, $secret, $assoc_type)
    {
        $issued = time();
        $lifetime = $expires_in;
        return new Auth_OpenID_Association($handle, $secret, $issued, $lifetime, $assoc_type);
    }

Usage Example

Exemplo n.º 1
0
	/**
	 * Make a new association.
	 */
	function createAssociation($dumb = true, $assoc_type = 'HMAC-SHA1')
	{
		$secret = Auth_OpenID_CryptUtil::getBytes(
		Auth_OpenID_getSecretSize($assoc_type));

		$uniq = base64_encode(Auth_OpenID_CryptUtil::getBytes(4));
		$handle = sprintf('{%s}{%x}{%s}', $assoc_type, intval(time()), $uniq);

		$assoc = Auth_OpenID_Association::fromExpiresIn(
		$this->SECRET_LIFETIME, $handle, $secret, $assoc_type);

		if ($dumb) {
			$key = $this->dumb_key;
		} else {
			$key = $this->normal_key;
		}

		$this->store->storeAssociation($key, $assoc);
		return $assoc;
	}
All Usage Examples Of Auth_OpenID_Association::fromExpiresIn