feat!: Tokens are now enabled by default.

This commit is contained in:
James Harton 2024-04-10 12:00:38 +12:00 committed by James Harton
parent d697e0313d
commit 03b38bdcb4
4 changed files with 2 additions and 4 deletions

View file

@ -118,7 +118,7 @@ Configure JWT settings for this resource
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`token_resource`](#authentication-tokens-token_resource){: #authentication-tokens-token_resource .spark-required} | `module \| false` | | The resource used to store token information, such as in-flight confirmations, revocations, and if `store_all_tokens?` is enabled, authentication tokens themselves. |
| [`enabled?`](#authentication-tokens-enabled?){: #authentication-tokens-enabled? } | `boolean` | `false` | Should JWTs be generated by this resource? |
| [`enabled?`](#authentication-tokens-enabled?){: #authentication-tokens-enabled? } | `boolean` | `true` | Should JWTs be generated by this resource? |
| [`store_all_tokens?`](#authentication-tokens-store_all_tokens?){: #authentication-tokens-store_all_tokens? } | `boolean` | `false` | Store all tokens in the `token_resource`. See the [tokens guide](/documentation/topics/tokens.md) for more. |
| [`require_token_presence_for_authentication?`](#authentication-tokens-require_token_presence_for_authentication?){: #authentication-tokens-require_token_presence_for_authentication? } | `boolean` | `false` | Require a locally-stored token for authentication. See the [tokens guide](/documentation/topics/tokens.md) for more. |
| [`signing_algorithm`](#authentication-tokens-signing_algorithm){: #authentication-tokens-signing_algorithm } | `String.t` | `"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. |

View file

@ -184,7 +184,6 @@ defmodule MyApp.Accounts.User do
end
tokens do
enabled? true
token_resource MyApp.Accounts.Token
signing_secret fn _, _ ->
Application.fetch_env(:my_app, :token_signing_secret)

View file

@ -77,7 +77,7 @@ defmodule AshAuthentication.Dsl do
doc: """
Should JWTs be generated by this resource?
""",
default: false
default: true
],
store_all_tokens?: [
type: :boolean,

View file

@ -23,7 +23,6 @@ defmodule AshAuthentication.Jwt do
authentication do
tokens do
enabled? true
token_lifetime 32
signing_secret fn _, _ ->
System.fetch_env("TOKEN_SIGNING_SECRET")