class CredentialsWrapper

The CredentialsWrapper object provides a wrapper around a FetchAuthTokenInterface.

Traits

Methods

static array
validate(array $arr, array $requiredKeys)

No description

static array
validateNotNull(array $arr, array $requiredKeys)

No description

__construct(FetchAuthTokenInterface $credentialsFetcher, callable $authHttpHandler = null)

CredentialsWrapper constructor.

build(array $args = [])

Factory method to create a CredentialsWrapper from an array of options.

string
getBearerString()

No description

callable

Details

in ValidationTrait at line 41
static array validate(array $arr, array $requiredKeys)

Parameters

array $arr Associative array
array $requiredKeys List of keys to check for in $arr

Return Value

array Returns $arr for fluent use

in ValidationTrait at line 51
static array validateNotNull(array $arr, array $requiredKeys)

Parameters

array $arr Associative array
array $requiredKeys List of keys to check for in $arr

Return Value

array Returns $arr for fluent use

at line 65
__construct(FetchAuthTokenInterface $credentialsFetcher, callable $authHttpHandler = null)

CredentialsWrapper constructor.

Parameters

FetchAuthTokenInterface $credentialsFetcher A credentials loader used to fetch access tokens.
callable $authHttpHandler A handler used to deliver PSR-7 requests specifically for authentication. Should match a signature of function (RequestInterface $request, array $options) : ResponseInterface.

Exceptions

ValidationException

at line 97
static CredentialsWrapper build(array $args = [])

Factory method to create a CredentialsWrapper from an array of options.

Parameters

array $args { An array of optional arguments.

@type string|array $keyFile
      Credentials to be used. Accepts either a path to a credentials file, or a decoded
      credentials file as a PHP array. If this is not specified, application default
      credentials will be used.
@type string[] $scopes
      A string array of scopes to use when acquiring credentials.
@type callable $authHttpHandler
      A handler used to deliver PSR-7 requests specifically
      for authentication. Should match a signature of
      `function (RequestInterface $request, array $options) : ResponseInterface`.
@type bool $enableCaching
      Enable caching of access tokens. Defaults to true.
@type CacheItemPoolInterface $authCache
      A cache for storing access tokens. Defaults to a simple in memory implementation.
@type array $authCacheOptions
      Cache configuration options.

}

Return Value

CredentialsWrapper

Exceptions

ValidationException

at line 141
string getBearerString()

Return Value

string Bearer string containing access token.

at line 149
callable getAuthorizationHeaderCallback()

Return Value

callable Callable function that returns an authorization header.