diff --git a/lib/ash_authentication/add_ons/confirmation/dsl.ex b/lib/ash_authentication/add_ons/confirmation/dsl.ex index e406222..2864af1 100644 --- a/lib/ash_authentication/add_ons/confirmation/dsl.ex +++ b/lib/ash_authentication/add_ons/confirmation/dsl.ex @@ -21,7 +21,7 @@ defmodule AshAuthentication.AddOn.Confirmation.Dsl do describe: "User confirmation flow", args: [{:optional, :name, :confirm}], target: Confirmation, - modules: [:sender], + no_depend_modules: [:sender], schema: [ name: [ type: :atom, diff --git a/lib/ash_authentication/dsl.ex b/lib/ash_authentication/dsl.ex index 8a63614..9aa4199 100644 --- a/lib/ash_authentication/dsl.ex +++ b/lib/ash_authentication/dsl.ex @@ -41,7 +41,7 @@ defmodule AshAuthentication.Dsl do %Section{ name: :authentication, describe: "Configure authentication for this resource", - modules: [:domain], + no_depend_modules: [:domain], schema: [ subject_name: [ type: :atom, @@ -70,7 +70,7 @@ defmodule AshAuthentication.Dsl do %Section{ name: :tokens, describe: "Configure JWT settings for this resource", - modules: [:token_resource], + no_depend_modules: [:token_resource, :signing_secret], schema: [ enabled?: [ type: :boolean, diff --git a/lib/ash_authentication/strategies/magic_link/dsl.ex b/lib/ash_authentication/strategies/magic_link/dsl.ex index 5f04c6b..00fd5e3 100644 --- a/lib/ash_authentication/strategies/magic_link/dsl.ex +++ b/lib/ash_authentication/strategies/magic_link/dsl.ex @@ -13,6 +13,7 @@ defmodule AshAuthentication.Strategy.MagicLink.Dsl do args: [{:optional, :name, :magic_link}], hide: [:name], target: MagicLink, + no_depend_modules: [:sender], schema: [ name: [ type: :atom, diff --git a/lib/ash_authentication/strategies/oauth2/dsl.ex b/lib/ash_authentication/strategies/oauth2/dsl.ex index 40f4698..0301d43 100644 --- a/lib/ash_authentication/strategies/oauth2/dsl.ex +++ b/lib/ash_authentication/strategies/oauth2/dsl.ex @@ -17,7 +17,7 @@ defmodule AshAuthentication.Strategy.OAuth2.Dsl do describe: "OAuth2 authentication", args: [{:optional, :name, :oauth2}], target: OAuth2, - modules: [ + no_depend_modules: [ :authorize_url, :base_url, :client_id, diff --git a/lib/ash_authentication/strategies/oauth2/plug.ex b/lib/ash_authentication/strategies/oauth2/plug.ex index 47a6247..43f297e 100644 --- a/lib/ash_authentication/strategies/oauth2/plug.ex +++ b/lib/ash_authentication/strategies/oauth2/plug.ex @@ -202,11 +202,12 @@ defmodule AshAuthentication.Strategy.OAuth2.Plug do end defp add_http_adapter(config) do - http_adapter = Application.get_env( - :ash_authentication, - :http_adapter, - {Finch, supervisor: AshAuthentication.Finch} - ) + http_adapter = + Application.get_env( + :ash_authentication, + :http_adapter, + {Finch, supervisor: AshAuthentication.Finch} + ) {:ok, Map.put(config, :http_adapter, http_adapter)} end diff --git a/lib/ash_authentication/strategies/password/dsl.ex b/lib/ash_authentication/strategies/password/dsl.ex index 043e3cd..af336c6 100644 --- a/lib/ash_authentication/strategies/password/dsl.ex +++ b/lib/ash_authentication/strategies/password/dsl.ex @@ -29,7 +29,7 @@ defmodule AshAuthentication.Strategy.Password.Dsl do args: [{:optional, :name, :password}], hide: [:name], target: Password, - modules: [:hash_provider], + no_depend_modules: [:hash_provider], singleton_entity_keys: [:resettable], schema: [ name: [ @@ -133,6 +133,7 @@ defmodule AshAuthentication.Strategy.Password.Dsl do name: :resettable, describe: "Configure password reset options for the resource", target: Password.Resettable, + no_depend_modules: [:sender], schema: [ token_lifetime: [ type: diff --git a/lib/ash_authentication/strategies/password/strategy.ex b/lib/ash_authentication/strategies/password/strategy.ex index 7dc3f93..e103260 100644 --- a/lib/ash_authentication/strategies/password/strategy.ex +++ b/lib/ash_authentication/strategies/password/strategy.ex @@ -43,6 +43,7 @@ defimpl AshAuthentication.Strategy, for: AshAuthentication.Strategy.Password do @doc false @spec method_for_phase(Password.t(), phase) :: Strategy.http_method() + def method_for_phase(_, phase) when phase in [:sign_in_with_token], do: :get def method_for_phase(_, _), do: :post @doc """ diff --git a/lib/ash_authentication/token_resource.ex b/lib/ash_authentication/token_resource.ex index c38ddaf..23190ab 100644 --- a/lib/ash_authentication/token_resource.ex +++ b/lib/ash_authentication/token_resource.ex @@ -5,7 +5,7 @@ defmodule AshAuthentication.TokenResource do %Spark.Dsl.Section{ name: :token, describe: "Configuration options for this token resource", - modules: [:domain], + no_depend_modules: [:domain], schema: [ domain: [ type: {:behaviour, Ash.Domain}, diff --git a/lib/ash_authentication/user_identity.ex b/lib/ash_authentication/user_identity.ex index 99bf222..efb9260 100644 --- a/lib/ash_authentication/user_identity.ex +++ b/lib/ash_authentication/user_identity.ex @@ -3,7 +3,7 @@ defmodule AshAuthentication.UserIdentity do %Spark.Dsl.Section{ name: :user_identity, describe: "Configure identity options for this resource", - modules: [:domain, :user_resource], + no_depend_modules: [:domain, :user_resource], schema: [ domain: [ type: {:behaviour, Ash.Domain}, diff --git a/test/ash_authentication/strategies/password/strategy_test.exs b/test/ash_authentication/strategies/password/strategy_test.exs index 1422701..117af68 100644 --- a/test/ash_authentication/strategies/password/strategy_test.exs +++ b/test/ash_authentication/strategies/password/strategy_test.exs @@ -68,6 +68,14 @@ defmodule AshAuthentication.Strategy.Password.StrategyTest do |> Strategy.method_for_phase(unquote(phase)) end end + + for phase <- ~w[sign_in_with_token]a do + test "it is get for the #{phase} phase" do + assert :get == + %Password{} + |> Strategy.method_for_phase(unquote(phase)) + end + end end describe "Strategy.routes/1" do