View Source AshAuthentication.Info (ash_authentication v4.3.6)

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

dsl_or_resource()

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

Functions

authentication_add_ons(dsl_or_extended)

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

authentication.add_ons DSL entities

authentication_domain(dsl_or_extended)

@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.

authentication_domain!(dsl_or_extended)

@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.

authentication_get_by_subject_action_name(dsl_or_extended)

@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.

authentication_get_by_subject_action_name!(dsl_or_extended)

@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.

authentication_options(dsl_or_extended)

@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.

authentication_select_for_senders(dsl_or_extended)

@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.

authentication_select_for_senders!(dsl_or_extended)

@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.

authentication_strategies(dsl_or_extended)

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

authentication.strategies DSL entities

authentication_subject_name(dsl_or_extended)

@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).

authentication_subject_name!(dsl_or_extended)

@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).

authentication_tokens_enabled?(dsl_or_extended)

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

Should JWTs be generated by this resource?

authentication_tokens_options(dsl_or_extended)

@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.

authentication_tokens_require_token_presence_for_authentication?(dsl_or_extended)

@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.

authentication_tokens_signing_algorithm(dsl_or_extended)

@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.

authentication_tokens_signing_algorithm!(dsl_or_extended)

@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.

authentication_tokens_signing_secret(dsl_or_extended)

@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.

authentication_tokens_signing_secret!(dsl_or_extended)

@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.

authentication_tokens_store_all_tokens?(dsl_or_extended)

@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.

authentication_tokens_token_lifetime(dsl_or_extended)

@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.

authentication_tokens_token_lifetime!(dsl_or_extended)

@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.

authentication_tokens_token_resource(dsl_or_extended)

@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.

authentication_tokens_token_resource!(dsl_or_extended)

@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.

domain(dsl_or_resource)

@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.

domain!(dsl_or_resource)

Raising version of domain/1

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

@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.

strategy(dsl_or_resource, name)

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

Retrieve a named strategy from a resource.

strategy!(dsl_or_resource, name)

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

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

strategy_for_action(dsl_or_resource, action_name)

@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.

strategy_for_action!(dsl_or_resource, action_name)

@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.