class AccessToken (View source)

Wrapper around Google Access Tokens which provides convenience functions.

Constants

FEDERATED_SIGNON_CERT_URL

IAP_CERT_URL

IAP_ISSUER

OAUTH2_ISSUER

OAUTH2_ISSUER_HTTPS

OAUTH2_REVOKE_URI

Methods

__construct(callable $httpHandler = null, CacheItemPoolInterface $cache = null)

No description

array|bool
verify(string $token, array $options = [])

Verifies an id token and returns the authenticated apiLoginTicket.

bool
revoke(string|array $token, array $options = [])

Revoke an OAuth2 access token or refresh token. This method will revoke the current access token, if a token isn't provided.

mixed
callJwtStatic(string $method, array $args = [])

Provide a hook to mock calls to the JWT static methods.

mixed
callSimpleJwtDecode(array $args = [])

Provide a hook to mock calls to the JWT static methods.

Details

__construct(callable $httpHandler = null, CacheItemPoolInterface $cache = null)

No description

Parameters

callable $httpHandler

[optional] An HTTP Handler to deliver PSR-7 requests.

CacheItemPoolInterface $cache

[optional] A PSR-6 compatible cache implementation.

array|bool verify(string $token, array $options = [])

Verifies an id token and returns the authenticated apiLoginTicket.

Throws an exception if the id token is not valid. The audience parameter can be used to control which id tokens are accepted. By default, the id token must have been issued to this OAuth2 client.

Parameters

string $token

The JSON Web Token to be verified.

array $options

[optional] { Configuration options.

@type string $audience The indended recipient of the token.
@type string $issuer The intended issuer of the token.
@type string $certsLocation The location (remote or local) from which
   to retrieve certificates, if not cached. This value should only be
   provided in limited circumstances in which you are sure of the
   behavior.
@type string $cacheKey The cache key of the cached certs. Defaults to
   the sha1 of $certsLocation if provided, otherwise is set to
   "federated_signon_certs_v3".
@type bool $throwException Whether the function should throw an
   exception if the verification fails. This is useful for
   determining the reason verification failed.

}

Return Value

array|bool

the token payload, if successful, or false if not.

Exceptions

InvalidArgumentException
InvalidArgumentException
InvalidArgumentException
RuntimeException
UnexpectedValueException
UnexpectedValueException

bool revoke(string|array $token, array $options = [])

Revoke an OAuth2 access token or refresh token. This method will revoke the current access token, if a token isn't provided.

Parameters

string|array $token

The token (access token or a refresh token) that should be revoked.

array $options

[optional] Configuration options.

Return Value

bool

Returns True if the revocation was successful, otherwise False.

protected mixed callJwtStatic(string $method, array $args = [])

Provide a hook to mock calls to the JWT static methods.

Parameters

string $method
array $args

Return Value

mixed

protected mixed callSimpleJwtDecode(array $args = [])

Provide a hook to mock calls to the JWT static methods.

Parameters

array $args

Return Value

mixed