mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-19 12:52:55 +12:00
improvement: use no_depend_modules
for better compile dependencies
This commit is contained in:
parent
e5a9f27c6a
commit
3562aea431
10 changed files with 24 additions and 12 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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 """
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue