KeycloakOIDCPasswordAuth#
- class eodag.plugins.authentication.keycloak.KeycloakOIDCPasswordAuth(provider, config)[source]#
Authentication plugin using Keycloak and OpenId Connect.
This plugin requests a token which is added to a query-string or a header for authentication.
- Parameters:
provider (
str) – provider nameconfig (
PluginConfig) –Authentication plugin configuration:
type(str) (mandatory): KeycloakOIDCPasswordAuthoidc_config_url(str) (mandatory): The url to get the OIDC Provider’s endpointsclient_id(str) (mandatory): keycloak client idclient_secret(str) (mandatory): keycloak client secret, set to null if no secret is usedtoken_provision(str) (mandatory): if the token should be added to the query string (qs) or to the header (header)token_qs_key(str): (mandatory if token_provision=qs) key of the param added to the query stringallowed_audiences(list[str]) (mandatory): The allowed audiences that have to be present in the user token.auth_error_code(int): which error code is returned in case of an authentication errorssl_verify(bool): If the SSL certificates should be verified in the token request; default:Truetoken_expiration_margin(int): The margin of time (in seconds) before a token is considered expired. Default: 60 seconds
Using
HTTPDownloada download linkhttp://example.com?foo=barwill becomehttp://example.com?foo=bar&my-token=obtained-tokenif associated to the following configuration:provider: ... auth: plugin: KeycloakOIDCPasswordAuth oidc_config_url: 'https://somewhere/auth/realms/realm/.well-known/openid-configuration' client_id: 'SOME_ID' client_secret: '01234-56789' token_provision: qs token_qs_key: 'my-token' ... ...
If configured to send the token through the header, the download request header will be updated with
Authorization: "Bearer obtained-token"if associated to the following configuration:provider: ... auth: plugin: KeycloakOIDCPasswordAuth oidc_config_url: 'https://somewhere/auth/realms/realm/.well-known/openid-configuration' client_id: 'SOME_ID' client_secret: '01234-56789' token_provision: header ... ...
- __init__(provider, config)[source]#
- Parameters:
provider (
str)config (
PluginConfig)
Methods
__init__(provider, config)authenticate()Makes authentication request
authenticate_objects(bucket_names_and_prefixes)Authenticates with s3 and retrieves the available objects
decode_jwt_token(token)Decode JWT token.
validate_config_credentials()Validate configured credentials
Attributes
GRANT_TYPEREQUIRED_PARAMSpluginsjwks_clientaccess_tokenaccess_token_expirationrefresh_tokenrefresh_token_expirationtoken_endpointauthorization_endpoint