pub struct AuthenticationManager { /* private fields */ }
Expand description

Authentication manager is responsible for caching and obtaing credentials for the required scope

Construct the authentication manager with AuthenticationManager::new() or by creating a CustomServiceAccount, then converting it into an AuthenticationManager using the From impl.

Implementations

Finds a service account provider to get authentication tokens from

Tries the following approaches, in order:

  1. Check if the GOOGLE_APPLICATION_CREDENTIALS environment variable if set; if so, use a custom service account as the token source.
  2. Check if the gcloud tool is available on the PATH; if so, use the gcloud auth print-access-token command as the token source.
  3. Send a HTTP request to the internal metadata server to retrieve a token; if it succeeds, use the default service account as the token source.
  4. Look for credentials in .config/gcloud/application_default_credentials.json; if found, use these credentials to request refresh tokens.

Requests Bearer token for the provided scope

Token can be used in the request authorization header in format “Bearer {token}”

Request the project ID for the authenticating account

This is only available for service account-based authentication methods.

Trait Implementations

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more