View Source AshAuthentication.Info (ash_authentication v4.2.5)

Generated configuration functions based on a resource's DSL configuration.

Summary

Functions

authentication.add_ons DSL entities

The name of the Ash domain to use to access this resource when doing anything authentication related.

The name of the Ash domain to use to access this resource when doing anything authentication related.

The name of the read action used to retrieve records. If the action doesn't exist, one will be generated for you.

The name of the read action used to retrieve records. If the action doesn't exist, one will be generated for you.

authentication DSL options

A list of fields that we will ensure are selected whenever a sender will be invoked. Defaults to [:email] if there is an :email attribute on the resource, and [] otherwise.

A list of fields that we will ensure are selected whenever a sender will be invoked. Defaults to [:email] if there is an :email attribute on the resource, and [] otherwise.

authentication.strategies DSL entities

The subject name is used anywhere that a short version of your resource name is needed. Must be unique system-wide and will be inferred from the resource name by default (ie MyApp.Accounts.User -> user).

The subject name is used anywhere that a short version of your resource name is needed. Must be unique system-wide and will be inferred from the resource name by default (ie MyApp.Accounts.User -> user).

Should JWTs be generated by this resource?

authentication.tokens DSL options

Require a locally-stored token for authentication. See the tokens guide for more.

The algorithm to use for token signing. Available signing algorithms are; EdDSA, Ed448ph, Ed448, Ed25519ph, Ed25519, PS512, PS384, PS256, ES512, ES384, ES256, RS512, RS384, RS256, HS512, HS384 and HS256.

The algorithm to use for token signing. Available signing algorithms are; EdDSA, Ed448ph, Ed448, Ed25519ph, Ed25519, PS512, PS384, PS256, ES512, ES384, ES256, RS512, RS384, RS256, HS512, HS384 and HS256.

The secret used to sign tokens. Takes either a module which implements the AshAuthentication.Secret behaviour, a 2 arity anonymous function or a string.

The secret used to sign tokens. Takes either a module which implements the AshAuthentication.Secret behaviour, a 2 arity anonymous function or a string.

Store all tokens in the token_resource. See the tokens guide for more.

How long a token should be valid. See the tokens guide for more.

How long a token should be valid. See the tokens guide for more.

The resource used to store token information, such as in-flight confirmations, revocations, and if store_all_tokens? is enabled, authentication tokens themselves.

The resource used to store token information, such as in-flight confirmations, revocations, and if store_all_tokens? is enabled, authentication tokens themselves.

Retrieve the domain to use for authentication.

Raising version of domain/1

Find the underlying strategy that required a change/preparation to be used.

Retrieve a named strategy from a resource.

Retrieve a named strategy from a resource (raising version).

Given an action name, retrieve the strategy it is for from the DSL configuration.

Given an action name, retrieve the strategy it is for from the DSL configuration.

Types

@type dsl_or_resource() :: module() | map()

Functions

Link to this function

authentication_add_ons(dsl_or_extended)

View Source
@spec authentication_add_ons(dsl_or_extended :: module() | map()) :: [struct()]

authentication.add_ons DSL entities

Link to this function

authentication_domain(dsl_or_extended)

View Source
@spec authentication_domain(dsl_or_extended :: module() | map()) ::
  {:ok, module()} | :error

The name of the Ash domain to use to access this resource when doing anything authentication related.

Link to this function

authentication_domain!(dsl_or_extended)

View Source
@spec authentication_domain!(dsl_or_extended :: module() | map()) ::
  module() | no_return()

The name of the Ash domain to use to access this resource when doing anything authentication related.

Link to this function

authentication_get_by_subject_action_name(dsl_or_extended)

View Source
@spec authentication_get_by_subject_action_name(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error

The name of the read action used to retrieve records. If the action doesn't exist, one will be generated for you.

Link to this function

authentication_get_by_subject_action_name!(dsl_or_extended)

View Source
@spec authentication_get_by_subject_action_name!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()

The name of the read action used to retrieve records. If the action doesn't exist, one will be generated for you.

Link to this function

authentication_options(dsl_or_extended)

View Source
@spec authentication_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

authentication DSL options

Returns a map containing the and any configured or default values.

Link to this function

authentication_select_for_senders(dsl_or_extended)

View Source
@spec authentication_select_for_senders(dsl_or_extended :: module() | map()) ::
  {:ok, [atom()]} | :error

A list of fields that we will ensure are selected whenever a sender will be invoked. Defaults to [:email] if there is an :email attribute on the resource, and [] otherwise.

Link to this function

authentication_select_for_senders!(dsl_or_extended)

View Source
@spec authentication_select_for_senders!(dsl_or_extended :: module() | map()) ::
  [atom()] | no_return()

A list of fields that we will ensure are selected whenever a sender will be invoked. Defaults to [:email] if there is an :email attribute on the resource, and [] otherwise.

Link to this function

authentication_strategies(dsl_or_extended)

View Source
@spec authentication_strategies(dsl_or_extended :: module() | map()) :: [struct()]

authentication.strategies DSL entities

Link to this function

authentication_subject_name(dsl_or_extended)

View Source
@spec authentication_subject_name(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error

The subject name is used anywhere that a short version of your resource name is needed. Must be unique system-wide and will be inferred from the resource name by default (ie MyApp.Accounts.User -> user).

Link to this function

authentication_subject_name!(dsl_or_extended)

View Source
@spec authentication_subject_name!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()

The subject name is used anywhere that a short version of your resource name is needed. Must be unique system-wide and will be inferred from the resource name by default (ie MyApp.Accounts.User -> user).

Link to this function

authentication_tokens_enabled?(dsl_or_extended)

View Source
@spec authentication_tokens_enabled?(dsl_or_extended :: module() | map()) :: boolean()

Should JWTs be generated by this resource?

Link to this function

authentication_tokens_options(dsl_or_extended)

View Source
@spec authentication_tokens_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

authentication.tokens DSL options

Returns a map containing the and any configured or default values.

Link to this function

authentication_tokens_require_token_presence_for_authentication?(dsl_or_extended)

View Source
@spec authentication_tokens_require_token_presence_for_authentication?(
  dsl_or_extended :: module() | map()
) :: boolean()

Require a locally-stored token for authentication. See the tokens guide for more.

Link to this function

authentication_tokens_signing_algorithm(dsl_or_extended)

View Source
@spec authentication_tokens_signing_algorithm(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

The algorithm to use for token signing. Available signing algorithms are; EdDSA, Ed448ph, Ed448, Ed25519ph, Ed25519, PS512, PS384, PS256, ES512, ES384, ES256, RS512, RS384, RS256, HS512, HS384 and HS256.

Link to this function

authentication_tokens_signing_algorithm!(dsl_or_extended)

View Source
@spec authentication_tokens_signing_algorithm!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

The algorithm to use for token signing. Available signing algorithms are; EdDSA, Ed448ph, Ed448, Ed25519ph, Ed25519, PS512, PS384, PS256, ES512, ES384, ES256, RS512, RS384, RS256, HS512, HS384 and HS256.

Link to this function

authentication_tokens_signing_secret(dsl_or_extended)

View Source
@spec authentication_tokens_signing_secret(dsl_or_extended :: module() | map()) ::
  {:ok, (module() | tuple() | (any(), any() -> any())) | String.t()} | :error

The secret used to sign tokens. Takes either a module which implements the AshAuthentication.Secret behaviour, a 2 arity anonymous function or a string.

Link to this function

authentication_tokens_signing_secret!(dsl_or_extended)

View Source
@spec authentication_tokens_signing_secret!(dsl_or_extended :: module() | map()) ::
  ((module() | tuple() | (any(), any() -> any())) | String.t()) | no_return()

The secret used to sign tokens. Takes either a module which implements the AshAuthentication.Secret behaviour, a 2 arity anonymous function or a string.

Link to this function

authentication_tokens_store_all_tokens?(dsl_or_extended)

View Source
@spec authentication_tokens_store_all_tokens?(dsl_or_extended :: module() | map()) ::
  boolean()

Store all tokens in the token_resource. See the tokens guide for more.

Link to this function

authentication_tokens_token_lifetime(dsl_or_extended)

View Source
@spec authentication_tokens_token_lifetime(dsl_or_extended :: module() | map()) ::
  {:ok, pos_integer() | {pos_integer(), :seconds | :minutes | :hours | :days}}
  | :error

How long a token should be valid. See the tokens guide for more.

Link to this function

authentication_tokens_token_lifetime!(dsl_or_extended)

View Source
@spec authentication_tokens_token_lifetime!(dsl_or_extended :: module() | map()) ::
  (pos_integer() | {pos_integer(), :seconds | :minutes | :hours | :days})
  | no_return()

How long a token should be valid. See the tokens guide for more.

Link to this function

authentication_tokens_token_resource(dsl_or_extended)

View Source
@spec authentication_tokens_token_resource(dsl_or_extended :: module() | map()) ::
  {:ok, module() | false} | :error

The resource used to store token information, such as in-flight confirmations, revocations, and if store_all_tokens? is enabled, authentication tokens themselves.

Link to this function

authentication_tokens_token_resource!(dsl_or_extended)

View Source
@spec authentication_tokens_token_resource!(dsl_or_extended :: module() | map()) ::
  (module() | false) | no_return()

The resource used to store token information, such as in-flight confirmations, revocations, and if store_all_tokens? is enabled, authentication tokens themselves.

@spec domain(dsl_or_resource()) :: {:ok, Ash.Domain.t()} | :error

Retrieve the domain to use for authentication.

If the authentication.domain DSL option is set, it will be used, otherwise it will default to that configured on the resource.

Link to this function

domain!(dsl_or_resource)

View Source

Raising version of domain/1

Link to this function

find_strategy(queryset, context \\ %{}, options)

View Source
@spec find_strategy(Ash.Query.t() | Ash.Changeset.t(), context, options) ::
  {:ok, AshAuthentication.Strategy.t()} | :error
when context: map(), options: Keyword.t()

Find the underlying strategy that required a change/preparation to be used.

This is because the strategy_name can be passed on the change options, eg:

change {AshAuthentication.Strategy.Password.HashPasswordChange, strategy_name: :banana_custard}

Or via the action context, eg:

prepare set_context(%{strategy_name: :banana_custard})
prepare AshAuthentication.Strategy.Password.SignInPreparation

Or via the passed-in context on calling the action.

Link to this function

strategy(dsl_or_resource, name)

View Source
@spec strategy(dsl_or_resource() | module(), atom()) :: {:ok, strategy} | :error
when strategy: struct()

Retrieve a named strategy from a resource.

Link to this function

strategy!(dsl_or_resource, name)

View Source
@spec strategy!(dsl_or_resource() | module(), atom()) :: strategy | no_return()
when strategy: struct()

Retrieve a named strategy from a resource (raising version).

Link to this function

strategy_for_action(dsl_or_resource, action_name)

View Source
@spec strategy_for_action(dsl_or_resource(), atom()) ::
  {:ok, AshAuthentication.Strategy.t()} | :error

Given an action name, retrieve the strategy it is for from the DSL configuration.

Link to this function

strategy_for_action!(dsl_or_resource, action_name)

View Source
@spec strategy_for_action!(dsl_or_resource(), atom()) ::
  AshAuthentication.Strategy.t() | no_return()

Given an action name, retrieve the strategy it is for from the DSL configuration.