chore(deps): Update to AshAuthentication 1.0.0. (#15)

This commit is contained in:
James Harton 2022-11-22 14:34:48 +13:00 committed by GitHub
parent af59f988fc
commit 408589b7aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 3 deletions

View file

@ -25,3 +25,11 @@ config :ash_authentication, AshAuthentication.Jwt,
signing_secret: "All I wanna do is to thank you, even though I don't know who you are."
config :phoenix, :json_library, Jason
config :ash_authentication_phoenix, Example.Accounts.User,
oauth2_authentication: [
client_id: System.get_env("OAUTH2_CLIENT_ID"),
client_secret: System.get_env("OAUTH2_CLIENT_SECRET"),
redirect_uri: "http://localhost:4000/auth",
site: System.get_env("OAUTH2_SITE")
]

View file

@ -43,6 +43,7 @@ defmodule AshAuthentication.Phoenix.MixProject do
Components: [
AshAuthentication.Phoenix.SignInLive,
AshAuthentication.Phoenix.Components.SignIn,
AshAuthentication.Phoenix.Components.OAuth2Authentication,
AshAuthentication.Phoenix.Components.PasswordAuthentication,
AshAuthentication.Phoenix.Components.PasswordAuthentication.SignInForm,
AshAuthentication.Phoenix.Components.PasswordAuthentication.RegisterForm,
@ -86,7 +87,7 @@ defmodule AshAuthentication.Phoenix.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:ash_authentication, github: "team-alembic/ash_authentication", tag: "v0.6.0"},
{:ash_authentication, github: "team-alembic/ash_authentication", tag: "v1.0.0"},
{:ash_phoenix, "~> 1.1"},
{:ash, "~> 2.2"},
{:jason, "~> 1.0"},

View file

@ -1,6 +1,6 @@
%{
"ash": {:hex, :ash, "2.4.2", "ba579e6654c32b1da49f17938d2f1445066f27e61eedbf0fae431b816b49d1be", [:mix], [{:comparable, "~> 1.0", [hex: :comparable, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: true]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8.0", [hex: :ets, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: false]}, {:spark, ">= 0.2.0", [hex: :spark, repo: "hexpm", optional: false]}, {:stream_data, "~> 0.5.0", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "da8f94a19cf29617526ca2b1a75f6fae804c1db7c825b49982c603f503a615bd"},
"ash_authentication": {:git, "https://github.com/team-alembic/ash_authentication.git", "3a54be6b32e53ec9f07f9bc19597f06edad61132", [tag: "v0.6.0"]},
"ash_authentication": {:git, "https://github.com/team-alembic/ash_authentication.git", "5471e498d0114e85e5940dab20aadd77050731ee", [tag: "v1.0.0"]},
"ash_phoenix": {:hex, :ash_phoenix, "1.1.2", "36c46852fa0e739d7217092ac71e3a72e729d5c00758f401234215d8d32f350b", [:mix], [{:ash, "~> 2.0", [hex: :ash, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.5.6 or ~> 1.6", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.15", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "9afb2c9e8dbb68d3549713b4a96b56801c250489efdf4776b931770bd629e0bd"},
"assent": {:hex, :assent, "0.2.1", "46ad0ed92b72330f38c60bc03c528e8408475dc386f48d4ecd18833cfa581b9f", [:mix], [{:castore, "~> 0.1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, ">= 0.0.0", [hex: :certifi, repo: "hexpm", optional: true]}, {:jose, "~> 1.8", [hex: :jose, repo: "hexpm", optional: true]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:ssl_verify_fun, ">= 0.0.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: true]}], "hexpm", "58c558b6029ffa287e15b38c8e07cd99f0b24e4846c52abad0c0a6225c4873bc"},
"bcrypt_elixir": {:hex, :bcrypt_elixir, "3.0.1", "9be815469e6bfefec40fa74658ecbbe6897acfb57614df1416eeccd4903f602c", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "486bb95efb645d1efc6794c1ddd776a186a9a713abf06f45708a6ce324fb96cf"},

View file

@ -6,7 +6,8 @@ defmodule Example.Accounts.User do
AshAuthentication,
AshAuthentication.Confirmation,
AshAuthentication.PasswordAuthentication,
AshAuthentication.PasswordReset
AshAuthentication.PasswordReset,
AshAuthentication.OAuth2Authentication
]
require Logger
@ -72,6 +73,20 @@ defmodule Example.Accounts.User do
end)
end
oauth2_authentication do
provider_name(:auth0)
client_id(&get_config/3)
redirect_uri(&get_config/3)
client_secret(&get_config/3)
site(&get_config/3)
authorize_path("/authorize")
token_path("/oauth/token")
user_path("/userinfo")
authorization_params(scope: "openid profile email")
auth_method(:client_secret_post)
end
tokens do
enabled?(true)
revocation_resource(Example.Accounts.TokenRevocation)
@ -80,4 +95,13 @@ defmodule Example.Accounts.User do
identities do
identity(:unique_email, [:email], pre_check_with: Example.Accounts)
end
def get_config(path, resource, _opts) do
value =
:ash_authentication_phoenix
|> Application.get_env(resource, [])
|> get_in(path)
{:ok, value}
end
end