Skip to content

Commit

Permalink
wip: make strategy names optional where it makes sense.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimsynz committed Jan 8, 2023
1 parent f117200 commit a62d3ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/ash_authentication/dsl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ defmodule AshAuthentication.Dsl do
end
"""
],
args: [:name],
args: [{:optional, :name, :password}],
hide: [:name],
target: Password,
modules: [:hash_provider],
Expand Down Expand Up @@ -302,7 +302,7 @@ defmodule AshAuthentication.Dsl do
%Entity{
name: :oauth2,
describe: "OAuth2 authentication",
args: [:name],
args: [{:optional, :name, :oauth2}],
target: OAuth2,
modules: [
:authorize_path,
Expand Down Expand Up @@ -581,7 +581,7 @@ defmodule AshAuthentication.Dsl do
%Entity{
name: :confirmation,
describe: "User confirmation flow",
args: [:name],
args: [{:optional, :name, :confirm}],
target: Confirmation,
modules: [:sender],
schema:
Expand Down Expand Up @@ -694,6 +694,7 @@ defmodule AshAuthentication.Dsl do
|> strategy()
|> Map.merge(%{
name: :auth0,
args: [{:optional, :name, :confirm}],
describe: "Auth0 authentication",
auto_set_fields: [
authorization_params: [scope: "openid profile email"],
Expand Down
6 changes: 3 additions & 3 deletions test/support/example/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ defmodule Example.User do
end

strategies do
password :password do
password do
resettable do
sender fn user, token ->
Logger.debug(
Expand All @@ -142,7 +142,7 @@ defmodule Example.User do
end
end

oauth2 :oauth2 do
oauth2 do
client_id &get_config/2
redirect_uri &get_config/2
client_secret &get_config/2
Expand All @@ -155,7 +155,7 @@ defmodule Example.User do
identity_resource Example.UserIdentity
end

auth0 :auth0 do
auth0 do
client_id &get_config/2
redirect_uri &get_config/2
client_secret &get_config/2
Expand Down

0 comments on commit a62d3ca

Please sign in to comment.