TokenAuth

TokenAuth#

class eodag.plugins.authentication.token.TokenAuth(provider, config)[source]#

TokenAuth authentication plugin - fetches a token which is added to search/download requests.

When using headers, if only headers is given, it will be used for both token retrieve and authentication. If retrieve_headers is given, it will be used for token retrieve only. If both are given, retrieve_headers will be used for token retrieve and headers for authentication.

Parameters:
  • provider (str) – provider name

  • config (PluginConfig) –

    Authentication plugin configuration:

    • type (str) (mandatory): TokenAuth

    • auth_uri (str) (mandatory): url used to fetch the access token with user/password

    • headers (dict[str, str]): Dictionary containing all keys/value pairs that should be added to the headers

    • retrieve_headers (dict[str, str]): Dictionary containing all keys/value pairs that should be added to the headers for token retrieve only

    • refresh_uri (str) : url used to fetch the access token with a refresh token

    • token_type (str): type of the token (json or text); default: text

    • token_key (str): (mandatory if token_type=json) key to get the access token in the response to the token request

    • refresh_token_key (str): key to get the refresh token in the response to the token request

    • token_expiration_key (str): key to get expiration time of the token (given in s)

    • ssl_verify (bool): if the ssl certificates should be verified in the requests; default: True

    • request_method (str): HTTP method to use; default: POST

    • auth_error_code (int): which error code is returned in case of an authentication error

    • req_data (dict[str, Any]): if the credentials should be sent as data in the post request, the json structure can be given in this parameter

    • retry_total (int): urllib3.util.Retry total parameter, total number of retries to allow; default: 3

    • retry_backoff_factor (int): urllib3.util.Retry backoff_factor parameter, backoff factor to apply between attempts after the second try; default: 2

    • retry_status_forcelist (list[int]): urllib3.util.Retry status_forcelist parameter, list of integer HTTP status codes that we should force a retry on; default: [401, 429, 500, 502, 503, 504]

    • token_expiration_margin (int): The margin of time (in seconds) before a token is considered expired. Default: 60 seconds.

__init__(provider, config)[source]#
Parameters:

Methods

__init__(provider, config)

authenticate()

Authenticate

authenticate_objects(bucket_names_and_prefixes)

Authenticates with s3 and retrieves the available objects

validate_config_credentials()

Validate configured credentials

Attributes

plugins