# `AshAuthentication.Info`
[🔗](https://github.com/team-alembic/ash_authentication/blob/main/lib/ash_authentication/info.ex#L5)

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

# `dsl_or_resource`

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

# `authentication_add_ons`

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

authentication.add_ons DSL entities

# `authentication_domain`

```elixir
@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!`

```elixir
@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`

```elixir
@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!`

```elixir
@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`

```elixir
@spec authentication_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) =&gt; any()
}
```

authentication DSL options

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

# `authentication_providers`

```elixir
@spec authentication_providers(dsl_or_extended :: module() | map()) :: [struct()]
```

authentication.providers DSL entities

# `authentication_select_for_senders`

```elixir
@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!`

```elixir
@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_session_identifier`

```elixir
@spec authentication_session_identifier(dsl_or_extended :: module() | map()) ::
  {:ok, :unsafe | :jti | :error} | :error
```

How to uniquely identify a session. Only necessary if  `require_token_presence_for_authentication?` is not set to `true`. Should always be `:jti`, if set.

# `authentication_session_identifier!`

```elixir
@spec authentication_session_identifier!(dsl_or_extended :: module() | map()) ::
  (:unsafe | :jti | :error) | no_return()
```

How to uniquely identify a session. Only necessary if  `require_token_presence_for_authentication?` is not set to `true`. Should always be `:jti`, if set.

# `authentication_strategies`

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

authentication.strategies DSL entities

# `authentication_subject_name`

```elixir
@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!`

```elixir
@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?`

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

Should JWTs be generated by this resource?

# `authentication_tokens_extra_claims`

```elixir
@spec authentication_tokens_extra_claims(dsl_or_extended :: module() | map()) ::
  {:ok, (any(), any() -&gt; any()) | map()} | :error
```

A 2-arity function `(user, opts) -> claims_map` or a static map of extra claims to include in tokens. See the tokens guide for more.

# `authentication_tokens_extra_claims!`

```elixir
@spec authentication_tokens_extra_claims!(dsl_or_extended :: module() | map()) ::
  ((any(), any() -&gt; any()) | map()) | no_return()
```

A 2-arity function `(user, opts) -> claims_map` or a static map of extra claims to include in tokens. See the tokens guide for more.

# `authentication_tokens_options`

```elixir
@spec authentication_tokens_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) =&gt; any()
}
```

authentication.tokens DSL options

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

# `authentication_tokens_require_token_presence_for_authentication?`

```elixir
@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](/documentation/topics/tokens.md) for more.

# `authentication_tokens_signing_algorithm`

```elixir
@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!`

```elixir
@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`

```elixir
@spec authentication_tokens_signing_secret(dsl_or_extended :: module() | map()) ::
  {:ok, (module() | tuple() | (any(), any() -&gt; 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!`

```elixir
@spec authentication_tokens_signing_secret!(dsl_or_extended :: module() | map()) ::
  ((module() | tuple() | (any(), any() -&gt; 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?`

```elixir
@spec authentication_tokens_store_all_tokens?(dsl_or_extended :: module() | map()) ::
  boolean()
```

Store all tokens in the `token_resource`. See the [tokens guide](/documentation/topics/tokens.md) for more.

# `authentication_tokens_token_lifetime`

```elixir
@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](/documentation/topics/tokens.md) for more.

# `authentication_tokens_token_lifetime!`

```elixir
@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](/documentation/topics/tokens.md) for more.

# `authentication_tokens_token_resource`

```elixir
@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!`

```elixir
@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`

```elixir
@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!`

Raising version of `domain/1`

# `find_strategy`

```elixir
@spec find_strategy(
  Ash.Query.t() | Ash.Changeset.t() | Ash.ActionInput.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:

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

Or via the action context, eg:

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

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

# `list_strategies`

```elixir
@spec list_strategies(dsl_or_resource()) :: [strategy] when strategy: struct()
```

Retrieve a list of all strategies and add-ons.

# `strategy`

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

Retrieve a named strategy from a resource.

# `strategy!`

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

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

# `strategy_enabled?`

```elixir
@spec strategy_enabled?(dsl_or_resource(), atom()) :: boolean()
```

Is at least one strategy of the provided type available?

# `strategy_for_action`

```elixir
@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!`

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

# `strategy_present?`

```elixir
@spec strategy_present?(dsl_or_resource() | module(), atom()) :: boolean()
```

Is the named strategy present on the resource?

---

*Consult [api-reference.md](api-reference.md) for complete listing*
