airflow.providers.google.cloud.utils.external_token_supplier
¶
Module Contents¶
Classes¶
A superclass for all Subject Token Supplier classes that wish to implement a caching mechanism. |
|
Class that retrieves an OIDC token from an external IdP using OAuth2.0 Client Credentials Grant flow. |
Functions¶
|
Cache calls to |
- airflow.providers.google.cloud.utils.external_token_supplier.cache_token_decorator(get_subject_token_method)[source]¶
Cache calls to
SubjectTokenSupplier
instances’get_token_supplier
methods.Different instances of a same SubjectTokenSupplier class with the same attributes share the OIDC token cache.
- Parameters
get_subject_token_method – A method that returns both a token and an integer specifying the time in seconds until the token expires
- class airflow.providers.google.cloud.utils.external_token_supplier.CacheTokenSupplier[source]¶
Bases:
airflow.utils.log.logging_mixin.LoggingMixin
,google.auth.identity_pool.SubjectTokenSupplier
A superclass for all Subject Token Supplier classes that wish to implement a caching mechanism.
Child classes must implement the
get_subject_key
method to generate a string that serves as the cache key, ensuring that tokens are shared appropriately among instances.- Methods:
get_subject_key: Abstract method to be implemented by child classes. It should return a string that serves as the cache key.
- class airflow.providers.google.cloud.utils.external_token_supplier.ClientCredentialsGrantFlowTokenSupplier(oidc_issuer_url, client_id, client_secret, **extra_params_kwargs)[source]¶
Bases:
CacheTokenSupplier
Class that retrieves an OIDC token from an external IdP using OAuth2.0 Client Credentials Grant flow.
This class implements the
SubjectTokenSupplier
interface class used bygoogle.auth.identity_pool.Credentials
- Params oidc_issuer_url
URL of the IdP that performs OAuth2.0 Client Credentials Grant flow and returns an OIDC token.
- Params client_id
Client ID of the application requesting the token
- Params client_secret
Client secret of the application requesting the token
- Params extra_params_kwargs
Extra parameters to be passed in the payload of the POST request to the oidc_issuer_url