blob: 41dcb106beb2ecb8bc7cb25373b42328f672bdd5 [file] [log] [blame]
:mod:`airflow.providers.google.common.utils.id_token_credentials`
=================================================================
.. py:module:: airflow.providers.google.common.utils.id_token_credentials
.. autoapi-nested-parse::
You can execute this module to get ID Token.
python -m airflow.providers.google.common.utils.id_token_credentials_provider
To obtain info about this token, run the following commands:
ID_TOKEN="$(python -m airflow.providers.google.common.utils.id_token_credentials)"
curl "https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=${ID_TOKEN}" -v
Module Contents
---------------
.. py:class:: IDTokenCredentialsAdapter(credentials: oauth2_credentials.Credentials)
Bases: :class:`google.auth.credentials.Credentials`
Convert Credentials with "openid" scope to IDTokenCredentials.
.. attribute:: expired
.. method:: refresh(self, request)
.. function:: _load_credentials_from_file(filename: str, target_audience: Optional[str]) -> Optional[google_auth_credentials.Credentials]
Loads credentials from a file.
The credentials file must be a service account key or a stored authorized user credential.
:param filename: The full path to the credentials file.
:type filename: str
:return: Loaded credentials
:rtype: google.auth.credentials.Credentials
:raise google.auth.exceptions.DefaultCredentialsError: if the file is in the wrong format or is missing.
.. function:: _get_explicit_environ_credentials(target_audience: Optional[str]) -> Optional[google_auth_credentials.Credentials]
Gets credentials from the GOOGLE_APPLICATION_CREDENTIALS environment variable.
.. function:: _get_gcloud_sdk_credentials(target_audience: Optional[str]) -> Optional[google_auth_credentials.Credentials]
Gets the credentials and project ID from the Cloud SDK.
.. function:: _get_gce_credentials(target_audience: Optional[str], request: Optional[google.auth.transport.Request] = None) -> Optional[google_auth_credentials.Credentials]
Gets credentials and project ID from the GCE Metadata Service.
.. function:: get_default_id_token_credentials(target_audience: Optional[str], request: google.auth.transport.Request = None) -> google_auth_credentials.Credentials
Gets the default ID Token credentials for the current environment.
`Application Default Credentials`_ provides an easy way to obtain credentials to call Google APIs for
server-to-server or local applications.
.. _Application Default Credentials: https://developers.google.com /identity/protocols/application-default-credentials
:param target_audience: The intended audience for these credentials.
:type target_audience: Sequence[str]
:param request: An object used to make HTTP requests. This is used to detect whether the application
is running on Compute Engine. If not specified, then it will use the standard library http client
to make requests.
:type request: google.auth.transport.Request
:return: the current environment's credentials.
:rtype: google.auth.credentials.Credentials
:raises ~google.auth.exceptions.DefaultCredentialsError:
If no credentials were found, or if the credentials found were invalid.
.. data:: request_adapter