Atex.Config.OAuth (atex v0.6.0)

View Source

Configuration management for Atex.OAuth.

Contains all the logic for fetching configuration needed for the OAuth module, as well as deriving useful values from them.

Configuration

The following structure is expected in your application config:

config :atex, Atex.OAuth,
  base_url: "https://example.com/oauth",  # Your application's base URL, including the path `Atex.OAuth` is mounted on.
  private_key: "base64-encoded-private-key",  # ES256 private key
  key_id: "your-key-id",  # Key identifier for JWTs
  scopes: ["transition:generic", "transition:email"],  # Optional additional scopes
  extra_redirect_uris: ["https://alternative.com/callback"],  # Optional additional redirect URIs
  is_localhost: false  # Set to true for local development

Summary

Functions

Returns the configured public base URL for OAuth routes.

Returns the client ID based on configuration.

Returns the configured extra redirect URIs.

Returns the configured private key as a JOSE.JWK.

Returns the configured redirect URI.

Returns the configured scopes joined as a space-separated string.

Functions

base_url()

@spec base_url() :: String.t()

Returns the configured public base URL for OAuth routes.

client_id()

@spec client_id() :: String.t()

Returns the client ID based on configuration.

If is_localhost is set, it'll be a string handling the "http://localhost" special case, with the redirect URI and scopes configured, otherwise it is a string pointing to the location of the client-metadata.json route.

extra_redirect_uris()

@spec extra_redirect_uris() :: [String.t()]

Returns the configured extra redirect URIs.

get_key()

@spec get_key() :: JOSE.JWK.t()

Returns the configured private key as a JOSE.JWK.

redirect_uri()

@spec redirect_uri() :: String.t()

Returns the configured redirect URI.

scopes()

@spec scopes() :: String.t()

Returns the configured scopes joined as a space-separated string.