TeslaOAuth2ClientAuth (tesla_oauth2_client_auth v1.0.0) View Source

Tesla middlewares for OAuth2 and OpenID Connect client authentication

Support

MethodImplementationProtocol
"none"TeslaOAuth2ClientAuth.NoneOAuth2
"client_secret_basic"TeslaOAuth2ClientAuth.ClientSecretBasicOAuth2
"client_secret_post"TeslaOAuth2ClientAuth.ClientSecretPostOAuth2
"client_secret_jwt"TeslaOAuth2ClientAuth.ClientSecretJWTOpenID Connect
"private_key_jwt"TeslaOAuth2ClientAuth.PrivateKeyJWTOpenID Connect

Note that Tesla does not support modifying TLS parameters in middlewares, which is why "tls_client_auth" and "self_signed_tls_client_auth" are unsupported.

Options

A TeslaOAuth2ClientAuth middleware receives a opts/0 as an option, which contains:

  • the client configuration (:client_config, see client_config/0)
  • the OAuth2 or OpenID Connect server metadata (:server_metadata)
  • any other option as documented by the implementations

Link to this section Summary

Types

Client configuration is a map whose keys are those documented in OpenID Connect Dynamic Client Registration 1.0 incorporating errata set 1.

OAuth2 or OpenID Connect server metadata as documented in one of

Functions

Returns the Elixir.TeslaOAuth2ClientAuth middleware for client authentication from client configuration (using the "token_endpoint_auth_method" configuration field) or an authentication method string

Returns the Elixir.TeslaOAuth2ClientAuth middleware for client authentication from client configuration (using the "token_endpoint_auth_method" configuration field) or an authentication method string

Link to this section Types

Specs

client_config() :: %{optional(String.t()) => any()}

Client configuration is a map whose keys are those documented in OpenID Connect Dynamic Client Registration 1.0 incorporating errata set 1.

Must at least contain the "client_id" field of the client.

Specs

opts() :: %{
  :client_config => client_config(),
  optional(:server_metadata) => server_metadata(),
  optional(atom()) => any()
}

Specs

server_metadata() :: %{optional(String.t()) => any()}

OAuth2 or OpenID Connect server metadata as documented in one of:

Link to this section Functions

Specs

implementation(client_config() | (token_endpoint_auth_method :: String.t())) ::
  {:ok, module()}
  | {:error, TeslaOAuth2ClientAuth.UnsupportedClientAuthenticationMethod.t()}

Returns the Elixir.TeslaOAuth2ClientAuth middleware for client authentication from client configuration (using the "token_endpoint_auth_method" configuration field) or an authentication method string

Link to this function

implementation!(conf_or_method)

View Source

Specs

implementation!(client_config() | (token_endpoint_auth_method :: String.t())) ::
  module() | no_return()

Returns the Elixir.TeslaOAuth2ClientAuth middleware for client authentication from client configuration (using the "token_endpoint_auth_method" configuration field) or an authentication method string