foundry_dev_tools.config.token_provider module#
The Foundry DevTools Token providers.
- class foundry_dev_tools.config.token_provider.TokenProvider[source]#
Bases:
object
The TokenProvider base class.
- Parameters:
host – the foundry host
- property token#
Returns the token from the provider.
- requests_auth_handler(r)[source]#
Sets bearer authentication header on PreparedRequest object.
Does not overwrite authorization header if present.
- Parameters:
r (PreparedRequest)
- Return type:
- class foundry_dev_tools.config.token_provider.JWTTokenProvider[source]#
Bases:
TokenProvider
Initialize the JWTTokenProvider.
- Parameters:
host – the foundry host
jwt – the jwt token
- property token: Token#
Returns the token supplied when creating this Provider.
- class foundry_dev_tools.config.token_provider.CachedTokenProvider[source]#
Bases:
TokenProvider
The TokenProvider base class.
- Parameters:
host – the foundry host
- property token: Token#
Returns the token from a dynamic source and caches it.
- class foundry_dev_tools.config.token_provider.OAuthTokenProvider[source]#
Bases:
CachedTokenProvider
Provides tokens via the OAuth authentication.
- Parameters:
host – the foundry host
client_id – the client ID
client_secret – the client secret, optional if the grant_type is authorization_code, and mandatory if the grant_type is client_credentials
grant_type – the OAuth grant type, see
FoundryOAuthGrantType
scopes – if the grant_type is authorization_code and not set it will default to
DEFAULT_OAUTH_SCOPES
, if the grant_type is client_credentials the scopes provided will be used, per default these are null
- __init__(host, client_id, client_secret=None, grant_type=None, scopes=None)[source]#
Provides tokens via the OAuth authentication.
- Parameters:
client_id (str) – the client ID
client_secret (str | None) – the client secret, optional if the grant_type is authorization_code, and mandatory if the grant_type is client_credentials
grant_type (FoundryOAuthGrantType | None) – the OAuth grant type, see
FoundryOAuthGrantType
scopes (list[str] | str | None) – if the grant_type is authorization_code and not set it will default to
DEFAULT_OAUTH_SCOPES
, if the grant_type is client_credentials the scopes provided will be used, per default these are null
- Return type:
None
- class foundry_dev_tools.config.token_provider.AppServiceTokenProvider[source]#
Bases:
CachedTokenProvider
The TokenProvider base class.
- Parameters:
host – the foundry host