class CredentialsWrapper (View source)

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, string $universeDomain = GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN)

CredentialsWrapper constructor.

build(array $args = [], string $universeDomain = GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN)

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

string|null
getQuotaProject()

No description

string
getBearerString() deprecated

No description

callable
getAuthorizationHeaderCallback(string $audience = null)

No description

Details

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

No description

Parameters

array $arr

Associative array

array $requiredKeys

List of keys to check for in $arr

Return Value

array

Returns $arr for fluent use

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

No description

Parameters

array $arr

Associative array

array $requiredKeys

List of keys to check for in $arr

Return Value

array

Returns $arr for fluent use

__construct(FetchAuthTokenInterface $credentialsFetcher, callable $authHttpHandler = null, string $universeDomain = GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN)

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.

string $universeDomain

Exceptions

ValidationException

static CredentialsWrapper build(array $args = [], string $universeDomain = GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN)

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.
@type string $quotaProject
      Specifies a user project to bill for access charges associated with the request.
@type string[] $defaultScopes
      A string array of default scopes to use when acquiring
      credentials.
@type bool $useJwtAccessWithScope
      Ensures service account credentials use JWT Access (also known as self-signed
      JWTs), even when user-defined scopes are supplied.

}

string $universeDomain

The expected universe of the credentials. Defaults to "googleapis.com"

Return Value

CredentialsWrapper

Exceptions

ValidationException

string|null getQuotaProject()

No description

Return Value

string|null

The quota project associated with the credentials.

string getBearerString() deprecated

deprecated

No description

Return Value

string

Bearer string containing access token.

callable getAuthorizationHeaderCallback(string $audience = null)

No description

Parameters

string $audience

optional audience for self-signed JWTs.

Return Value

callable

Callable function that returns an authorization header.