HTTPHeaderAuth

HTTPHeaderAuth#

class eodag.plugins.authentication.header.HTTPHeaderAuth(provider, config)[source]#

HTTPHeaderAuth Authentication plugin.

This plugin enables implementation of custom HTTP authentication scheme (other than Basic, Digest, Token negotiation et al.) using HTTP headers.

Parameters:
  • provider (str) – provider name

  • config (PluginConfig) –

    Authentication plugin configuration:

    • type (str) (mandatory): HTTPHeaderAuth

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

Below an example for the configuration in the providers config file is shown:

provider:
    ...
    auth:
        plugin: HTTPHeaderAuth
        headers:
            Authorization: "Something {userinput}"
            X-Special-Header: "Fixed value"
            X-Another-Special-Header: "{oh-my-another-user-input}"
        ...
    ...

As you can see in the sample above, the maintainer of provider define the headers that will be used in the authentication process as-is, by giving their names (e.g. Authorization) and their value (e.g "Something {userinput}") as regular Python string templates that enable passing in the user input necessary to compute its identity. The user input awaited in the header value string must be present in the user config file. In the sample above, the plugin await for user credentials to be specified as:

provider:
    credentials:
        userinput: XXX
        oh-my-another-user-input: YYY

Expect an undefined behaviour if you use empty braces in header value strings.

The plugin also accepts headers to be passed directly through credentials:

provider:
    ...
    auth:
        plugin: HTTPHeaderAuth
        credentials:
            Authorization: "Something XXX"
            X-Special-Header: "Fixed value"
            X-Another-Special-Header: "YYY"
        ...
    ...
__init__(provider, config)#
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