OneAuth.Config (OneAuth v0.1.0)

Copy Markdown View Source

Provides access to the OneAuth configuration.

Configuration values are read from the application environment and exposed through a small, typed API.

OneAuth is typically configured in config/runtime.exs:

config :one_auth,
  username: System.fetch_env!("ONE_AUTH_USERNAME"),
  password: System.fetch_env!("ONE_AUTH_PASSWORD"),
  signing_secret: System.fetch_env!("ONE_AUTH_SIGNING_SECRET")

See the Configuration Guide for all available options, recommended configuration, and environment variable examples.

See also

Summary

Functions

Returns the configured login path.

Returns the default destination after a successful login.

Returns the maximum session lifetime in milliseconds.

Returns the configured password.

Returns the configured signing secret.

Returns the configured username.

Functions

login_path()

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

Returns the configured login path.

Unauthenticated requests are redirected to this path by OneAuth.Plug.RequireAuth.

login_redirect_path()

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

Returns the default destination after a successful login.

This value is used by OneAuth.login_redirect_path/1 when the login request does not include a valid redirect_to query parameter.

max_session_age()

@spec max_session_age() :: pos_integer()

Returns the maximum session lifetime in milliseconds.

The default is 24 hours.

password()

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

Returns the configured password.

Raises an ArgumentError if no password has been configured.

signing_secret()

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

Returns the configured signing secret.

The signing secret is used to sign and verify OneAuth session tokens.

Raises an ArgumentError if no signing secret has been configured.

username()

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

Returns the configured username.

Raises an ArgumentError if no username has been configured.