Google Compute Engine authentication.
Bases: Scoped
, CredentialsWithQuotaProject
, CredentialsWithUniverseDomain
Compute Engine Credentials.
These credentials use the Google Compute Engine metadata server to obtain OAuth 2.0 access tokens associated with the instance’s service account, and are also used for Cloud Run, Flex and App Engine (except for the Python 2.7 runtime, which is supported only on older versions of this library).
For more information about Compute Engine authentication, including how to configure scopes, see the Compute Engine authentication documentation.
Note
On Compute Engine the metadata server ignores requested scopes. On Cloud Run, Flex and App Engine the server honours requested scopes.
service_account_email (str) – The service account email to use, or ‘default’. A Compute Engine instance may have multiple service accounts.
quota_project_id (Optional
str
) – The project ID used for quota and billing.
scopes (Optional
Sequence
str
) – The list of scopes for the credentials.
default_scopes (Optional
Sequence
str
) – Default scopes passed by a Google client library. Use ‘scopes’ for user-defined scopes.
universe_domain (Optional
str
) – The universe domain. If not provided or None, credential will attempt to fetch the value from metadata server. If metadata server doesn’t have universe domain endpoint, then the default googleapis.com will be used.
Refresh the access token and scopes.
request (google.auth.transport.Request) – The object used to make HTTP requests.
google.auth.exceptions.RefreshError – If the Compute Engine metadata service can’t be reached if if the instance has not credentials.
The service account email.
Note
This is not guaranteed to be set until refresh()
has been called.
True if these credentials require scopes to obtain an access token.
The universe domain value.
The credential information JSON.
The credential information will be added to auth related error messages by client library.
Returns a copy of these credentials with a modified quota project.
quota_project_id (str) – The project to use for quota and billing purposes
A new credentials instance.
Create a copy of these credentials with the specified scopes.
scopes (Sequence
str
) – The list of scopes to attach to the current credentials.
NotImplementedError – If the credentials’ scopes can not be changed. This can be avoided by checking requires_scopes
before calling this method.
Returns a copy of these credentials with a modified universe domain.
universe_domain (str) – The universe domain to use
A new credentials instance.
Apply the token to the authentication header.
Performs credential-specific before request logic.
Refreshes the credentials if necessary, then calls apply()
to apply the token to the authentication header.
request (google.auth.transport.Request) – The object used to make HTTP requests.
method (str) – The request’s HTTP method or the RPC method being invoked.
url (str) – The request’s URI or the RPC service’s URI.
headers (Mapping) – The request’s headers.
Checks if the credentials are expired.
Note that credentials can be invalid but not expired because Credentials with expiry
set to None is considered to never expire.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
Checks if the credentials have the given scopes.
Project to use for quota and billing purposes.
See :obj:`TokenState
Checks the validity of the credentials.
This is True if the credentials have a token
and the token is not expired
.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
Bases: CredentialsWithQuotaProject
, Signing
, CredentialsWithTokenUri
Open ID Connect ID Token-based service account credentials.
These credentials relies on the default service account of a GCE instance.
ID token can be requested from GCE metadata server identity endpoint, IAM token endpoint or other token endpoints you specify. If metadata server identity endpoint is not used, the GCE instance must have been started with a service account that has access to the IAM Cloud API.
request (google.auth.transport.Request) – The object used to make HTTP requests.
target_audience (str) – The intended audience for these credentials, used when requesting the ID Token. The ID Token’s aud
claim will be set to this string.
token_uri (str) – The OAuth 2.0 Token URI.
additional_claims (Mapping
str
, str
) – Any
additional claims for the JWT assertion used in the authorization grant.
service_account_email (str) – Optional explicit service account to use to sign JWT tokens. By default, this is the default GCE service account.
signer (google.auth.crypt.Signer) – The signer used to sign JWTs. In case the signer is specified, the request argument will be ignored.
use_metadata_identity_endpoint (bool) – Whether to use GCE metadata identity endpoint. For backward compatibility the default value is False. If set to True, token_uri
, additional_claims
, service_account_email
, signer
argument should not be set; otherwise ValueError will be raised.
quota_project_id (Optional
str
) – The project ID used for quota and billing.
ValueError – If use_metadata_identity_endpoint
is set to True, and one of token_uri
, additional_claims
, service_account_email
, signer
arguments is set.
Create a copy of these credentials with the specified target audience. :param target_audience: The intended audience for these credentials, :type target_audience: str :param used when requesting the ID Token.:
instance.
google.auth.service_account.IDTokenCredentials
Returns a copy of these credentials with a modified quota project.
quota_project_id (str) – The project to use for quota and billing purposes
A new credentials instance.
Returns a copy of these credentials with a modified token uri.
token_uri (str) – The uri to use for fetching/exchanging tokens
A new credentials instance.
Apply the token to the authentication header.
Performs credential-specific before request logic.
Refreshes the credentials if necessary, then calls apply()
to apply the token to the authentication header.
request (google.auth.transport.Request) – The object used to make HTTP requests.
method (str) – The request’s HTTP method or the RPC method being invoked.
url (str) – The request’s URI or the RPC service’s URI.
headers (Mapping) – The request’s headers.
Checks if the credentials are expired.
Note that credentials can be invalid but not expired because Credentials with expiry
set to None is considered to never expire.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
The credential information JSON.
The credential information will be added to auth related error messages by client library.
Project to use for quota and billing purposes.
See :obj:`TokenState
The universe domain value.
Checks the validity of the credentials.
This is True if the credentials have a token
and the token is not expired
.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
When the token expires and is no longer valid. If this is None, the token is assumed to never expire.
Refreshes the ID token.
request (google.auth.transport.Request) – The object used to make HTTP requests.
google.auth.exceptions.RefreshError – If the credentials could not be refreshed.
ValueError – If extracting expiry from the obtained ID token fails.
The signer used to sign bytes.
Signs the given message.
message (bytes) – The message to sign.
The message’s cryptographic signature.
ValueError – Signer is not available if metadata identity endpoint is used.
The service account email.
Detect Google Compute Engine residency by smbios check on Linux
True if the GCE product name file is detected, False otherwise.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4