mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-19 21:03:23 +12:00
docs: remove registries from docs and examples (#388)
This commit is contained in:
parent
d7e03ce111
commit
575785c3f2
6 changed files with 9 additions and 41 deletions
|
@ -24,11 +24,6 @@ config :ash_authentication, Example.Repo,
|
||||||
show_sensitive_data_on_connection_error: true,
|
show_sensitive_data_on_connection_error: true,
|
||||||
pool_size: 10
|
pool_size: 10
|
||||||
|
|
||||||
config :ash_authentication, Example,
|
|
||||||
resources: [
|
|
||||||
registry: Example.Registry
|
|
||||||
]
|
|
||||||
|
|
||||||
config :ash_authentication,
|
config :ash_authentication,
|
||||||
authentication: [
|
authentication: [
|
||||||
strategies: [
|
strategies: [
|
||||||
|
|
|
@ -10,11 +10,6 @@ config :ash_authentication, Example.Repo,
|
||||||
pool: Ecto.Adapters.SQL.Sandbox,
|
pool: Ecto.Adapters.SQL.Sandbox,
|
||||||
pool_size: 10
|
pool_size: 10
|
||||||
|
|
||||||
config :ash_authentication, Example,
|
|
||||||
resources: [
|
|
||||||
registry: Example.Registry
|
|
||||||
]
|
|
||||||
|
|
||||||
config :bcrypt_elixir, :log_rounds, 4
|
config :bcrypt_elixir, :log_rounds, 4
|
||||||
|
|
||||||
config :ash, :disable_async?, true
|
config :ash, :disable_async?, true
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule DevServer.JsonApiRouter do
|
defmodule DevServer.JsonApiRouter do
|
||||||
@moduledoc false
|
@moduledoc false
|
||||||
use AshJsonApi.Api.Router, api: Example, registry: Example.Registry
|
use AshJsonApi.Api.Router, api: Example
|
||||||
end
|
end
|
||||||
|
|
|
@ -101,7 +101,8 @@ defmodule MyApp.Accounts do
|
||||||
use Ash.Api
|
use Ash.Api
|
||||||
|
|
||||||
resources do
|
resources do
|
||||||
registry MyApp.Accounts.Registry
|
resource MyApp.Accounts.User
|
||||||
|
resource MyApp.Accounts.Token
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
@ -113,21 +114,6 @@ Be sure to add it to the `ash_apis` config in your `config.exs`
|
||||||
config :my_app, :ash_apis, [..., MyApp.Accounts]
|
config :my_app, :ash_apis, [..., MyApp.Accounts]
|
||||||
```
|
```
|
||||||
|
|
||||||
Next, let's define our registry:
|
|
||||||
|
|
||||||
```elixir
|
|
||||||
# lib/my_app/accounts/registry.ex
|
|
||||||
|
|
||||||
defmodule MyApp.Accounts.Registry do
|
|
||||||
use Ash.Registry, extensions: [Ash.Registry.ResourceValidations]
|
|
||||||
|
|
||||||
entries do
|
|
||||||
entry MyApp.Accounts.User
|
|
||||||
entry MyApp.Accounts.Token
|
|
||||||
end
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
Next, let's define our `Token` resource. This resource is needed
|
Next, let's define our `Token` resource. This resource is needed
|
||||||
if token generation is enabled for any resources in your application. Most of
|
if token generation is enabled for any resources in your application. Most of
|
||||||
the contents are auto-generated, so we just need to provide the data layer
|
the contents are auto-generated, so we just need to provide the data layer
|
||||||
|
@ -152,7 +138,7 @@ defmodule MyApp.Accounts.Token do
|
||||||
table "tokens"
|
table "tokens"
|
||||||
repo MyApp.Repo
|
repo MyApp.Repo
|
||||||
end
|
end
|
||||||
|
|
||||||
# If using policies, add the following bypass:
|
# If using policies, add the following bypass:
|
||||||
# policies do
|
# policies do
|
||||||
# bypass AshAuthentication.Checks.AshAuthenticationInteraction do
|
# bypass AshAuthentication.Checks.AshAuthenticationInteraction do
|
||||||
|
@ -205,7 +191,7 @@ defmodule MyApp.Accounts.User do
|
||||||
identities do
|
identities do
|
||||||
identity :unique_email, [:email]
|
identity :unique_email, [:email]
|
||||||
end
|
end
|
||||||
|
|
||||||
# If using policies, add the folowing bypass:
|
# If using policies, add the folowing bypass:
|
||||||
# policies do
|
# policies do
|
||||||
# bypass AshAuthentication.Checks.AshAuthenticationInteraction do
|
# bypass AshAuthentication.Checks.AshAuthenticationInteraction do
|
||||||
|
|
|
@ -3,7 +3,10 @@ defmodule Example do
|
||||||
use Ash.Api, otp_app: :ash_authentication, extensions: [AshGraphql.Api, AshJsonApi.Api]
|
use Ash.Api, otp_app: :ash_authentication, extensions: [AshGraphql.Api, AshJsonApi.Api]
|
||||||
|
|
||||||
resources do
|
resources do
|
||||||
registry Example.Registry
|
resource Example.User
|
||||||
|
resource Example.UserWithTokenRequired
|
||||||
|
resource Example.Token
|
||||||
|
resource Example.UserIdentity
|
||||||
end
|
end
|
||||||
|
|
||||||
json_api do
|
json_api do
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
defmodule Example.Registry do
|
|
||||||
@moduledoc false
|
|
||||||
use Ash.Registry, extensions: [Ash.Registry.ResourceValidations]
|
|
||||||
|
|
||||||
entries do
|
|
||||||
entry Example.User
|
|
||||||
entry Example.UserWithTokenRequired
|
|
||||||
entry Example.Token
|
|
||||||
entry Example.UserIdentity
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue