Caravela.Schema.AuthConfig (Caravela v0.13.2)

Copy Markdown View Source

Authentication configuration attached to an entity via the authenticatable DSL block.

Captures strategies, session/confirm/reset settings, and whether the entity declares on_register / on_login hooks. The actual hook functions are compiled into the domain module as clauses of __caravela_auth_hook__/4.

Summary

Functions

True if the api_token strategy is enabled.

True if email confirmation is enabled.

True if the password strategy is enabled.

True if password reset is enabled.

Options for a strategy (or nil if disabled).

Types

strategy()

@type strategy() :: {:password, keyword()} | {:api_token, keyword()}

t()

@type t() :: %Caravela.Schema.AuthConfig{
  confirm: keyword() | nil,
  on_login?: boolean(),
  on_register?: boolean(),
  reset: keyword() | nil,
  session: keyword() | nil,
  strategies: [strategy()]
}

Functions

api_token?(auth_config)

@spec api_token?(t()) :: boolean()

True if the api_token strategy is enabled.

confirm?(auth_config)

@spec confirm?(t()) :: boolean()

True if email confirmation is enabled.

password?(auth_config)

@spec password?(t()) :: boolean()

True if the password strategy is enabled.

reset?(auth_config)

@spec reset?(t()) :: boolean()

True if password reset is enabled.

strategy_opts(auth_config, name)

@spec strategy_opts(t(), atom()) :: keyword() | nil

Options for a strategy (or nil if disabled).