mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-19 12:52:55 +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,
|
||||
pool_size: 10
|
||||
|
||||
config :ash_authentication, Example,
|
||||
resources: [
|
||||
registry: Example.Registry
|
||||
]
|
||||
|
||||
config :ash_authentication,
|
||||
authentication: [
|
||||
strategies: [
|
||||
|
|
|
@ -10,11 +10,6 @@ config :ash_authentication, Example.Repo,
|
|||
pool: Ecto.Adapters.SQL.Sandbox,
|
||||
pool_size: 10
|
||||
|
||||
config :ash_authentication, Example,
|
||||
resources: [
|
||||
registry: Example.Registry
|
||||
]
|
||||
|
||||
config :bcrypt_elixir, :log_rounds, 4
|
||||
|
||||
config :ash, :disable_async?, true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
defmodule DevServer.JsonApiRouter do
|
||||
@moduledoc false
|
||||
use AshJsonApi.Api.Router, api: Example, registry: Example.Registry
|
||||
use AshJsonApi.Api.Router, api: Example
|
||||
end
|
||||
|
|
|
@ -101,7 +101,8 @@ defmodule MyApp.Accounts do
|
|||
use Ash.Api
|
||||
|
||||
resources do
|
||||
registry MyApp.Accounts.Registry
|
||||
resource MyApp.Accounts.User
|
||||
resource MyApp.Accounts.Token
|
||||
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]
|
||||
```
|
||||
|
||||
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
|
||||
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
|
||||
|
@ -152,7 +138,7 @@ defmodule MyApp.Accounts.Token do
|
|||
table "tokens"
|
||||
repo MyApp.Repo
|
||||
end
|
||||
|
||||
|
||||
# If using policies, add the following bypass:
|
||||
# policies do
|
||||
# bypass AshAuthentication.Checks.AshAuthenticationInteraction do
|
||||
|
@ -205,7 +191,7 @@ defmodule MyApp.Accounts.User do
|
|||
identities do
|
||||
identity :unique_email, [:email]
|
||||
end
|
||||
|
||||
|
||||
# If using policies, add the folowing bypass:
|
||||
# policies 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]
|
||||
|
||||
resources do
|
||||
registry Example.Registry
|
||||
resource Example.User
|
||||
resource Example.UserWithTokenRequired
|
||||
resource Example.Token
|
||||
resource Example.UserIdentity
|
||||
end
|
||||
|
||||
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