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
headersis given, it will be used for both token retrieve and authentication. Ifretrieve_headersis given, it will be used for token retrieve only. If both are given,retrieve_headerswill be used for token retrieve andheadersfor authentication.- Parameters:
provider (
str) – provider nameconfig (
PluginConfig) –Authentication plugin configuration:
type(str) (mandatory): TokenAuthauth_uri(str) (mandatory): url used to fetch the access token with user/passwordheaders(dict[str, str]): Dictionary containing all keys/value pairs that should be added to the headersretrieve_headers(dict[str, str]): Dictionary containing all keys/value pairs that should be added to the headers for token retrieve onlyrefresh_uri(str) : url used to fetch the access token with a refresh tokentoken_type(str): type of the token (jsonortext); default:texttoken_key(str): (mandatory if token_type=json) key to get the access token in the response to the token requestrefresh_token_key(str): key to get the refresh token in the response to the token requesttoken_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:Truerequest_method(str): HTTP method to use; default:POSTauth_error_code(int): which error code is returned in case of an authentication errorreq_data(dict[str, Any]): if the credentials should be sent as data in the post request, the json structure can be given in this parameterretry_total(int):urllib3.util.Retrytotalparameter, total number of retries to allow; default:3retry_backoff_factor(int):urllib3.util.Retrybackoff_factorparameter, backoff factor to apply between attempts after the second try; default:2retry_status_forcelist(list[int]):urllib3.util.Retrystatus_forcelistparameter, 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:
provider (
str)config (
PluginConfig)
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