class GrpcCredentialsHelper

A class that manages credentials for an API object using the Google Auth library

Methods

__construct(string[] $scopes, array $optionalArgs = [])

Accepts an optional credentialsLoader argument, to be used instead of using the ApplicationDefaultCredentials

createCallCredentialsCallback()

Creates the callback function to be passed to gRPC for providing the credentials for a call.

createStub(callable $generatedCreateStub, string $serviceAddress, mixed $port, array $options = [])

Creates a gRPC client stub.

getADCCredentials($scopes)

Gets credentials from ADC. This exists to allow overriding in unit tests.

createSslChannelCredentials()

Construct ssl channel credentials. This exists to allow overriding in unit tests.

Details

at line 67
__construct(string[] $scopes, array $optionalArgs = [])

Accepts an optional credentialsLoader argument, to be used instead of using the ApplicationDefaultCredentials

Parameters

string[] $scopes A list of scopes required for API access
array $optionalArgs { Optional arguments. Arguments in addition to those documented below will be passed as optional arguments to Google\Auth\FetchAuthTokenCache when caching is enabled.

@var \Google\Auth\CredentialsLoader $credentialsLoader
     A user-created CredentialsLoader object. Defaults to using
     ApplicationDefaultCredentials
@var boolean $enableCaching
     Enable caching of access tokens. Defaults to true

}

at line 98
createCallCredentialsCallback()

Creates the callback function to be passed to gRPC for providing the credentials for a call.

at line 130
createStub(callable $generatedCreateStub, string $serviceAddress, mixed $port, array $options = [])

Creates a gRPC client stub.

Parameters

callable $generatedCreateStub Function callback which must accept two arguments ($hostname, $opts) and return an instance of the stub of the specific API to call. Generally, this should just call the stub's constructor and return the instance.
string $serviceAddress The domain name of the API remote host.
mixed $port The port on which to connect to the remote host.
array $options { Optional. Options for configuring the gRPC stub.

@type \Grpc\ChannelCredentials $sslCreds
      A `ChannelCredentials` for use with an SSL-enabled channel.
      Default: a credentials object returned from
      \Grpc\ChannelCredentials::createSsl()

}

at line 149
protected getADCCredentials($scopes)

Gets credentials from ADC. This exists to allow overriding in unit tests.

Parameters

$scopes

at line 157
protected createSslChannelCredentials()

Construct ssl channel credentials. This exists to allow overriding in unit tests.