tesla_oauth2_client_auth v0.1.0 TeslaOAuth2ClientAuth 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 id (:client_id), mandatory
  • 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

Link to this type

client_config()

View Source
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.

Link to this type

opts()

View Source
opts() :: %{
  :client_id => String.t(),
  :client_config => client_config(),
  :server_metadata => server_metadata(),
  optional(atom()) => any()
}
Link to this type

server_metadata()

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

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

Link to this section Functions

Link to this function

implementation(config)

View Source
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
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