mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-21 22:02:52 +12:00
b05526908e
* chore(deps): Bump ash from 2.17.10 to 2.17.12 Bumps [ash](https://github.com/ash-project/ash) from 2.17.10 to 2.17.12. - [Release notes](https://github.com/ash-project/ash/releases) - [Changelog](https://github.com/ash-project/ash/blob/main/CHANGELOG.md) - [Commits](https://github.com/ash-project/ash/compare/v2.17.10...v2.17.12) --- updated-dependencies: - dependency-name: ash dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * docs: Update Spark DSL docs. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: James Harton <james@harton.nz>
81 lines
3.9 KiB
Markdown
81 lines
3.9 KiB
Markdown
<!--
|
|
This file was generated by Spark. Do not edit it by hand.
|
|
-->
|
|
# DSL: AshAuthentication.UserIdentity
|
|
|
|
An Ash extension which generates the default user identities resource.
|
|
|
|
The user identities resource is used to store information returned by remote
|
|
authentication strategies (such as those provided by OAuth2) and maps them to
|
|
your user resource(s). This provides the following benefits:
|
|
|
|
1. A user can be signed in to multiple authentication strategies at once.
|
|
2. For those provides which support it AshAuthentication can handle
|
|
automatic refreshing of tokens.
|
|
|
|
## Storage
|
|
|
|
User identities are expected to be relatively long-lived (although they're
|
|
deleted on log out), so should probably be stored using a permanent data layer
|
|
sush as `ash_postgres`.
|
|
|
|
## Usage
|
|
|
|
There is no need to define any attributes, etc. The extension will generate
|
|
them all for you. As there is no other use-case for this resource it's
|
|
unlikely that you will need to customise it.
|
|
|
|
```elixir
|
|
defmodule MyApp.Accounts.UserIdentity do
|
|
use Ash.Resource,
|
|
data_layer: AshPostgres.DataLayer,
|
|
extensions: [AshAuthentication.UserIdentity]
|
|
|
|
user_identity do
|
|
api MyApp.Accounts
|
|
user_resource MyApp.Accounts.User
|
|
end
|
|
|
|
postgres do
|
|
table "user_identities"
|
|
repo MyApp.Repo
|
|
end
|
|
end
|
|
```
|
|
|
|
If you intend to operate with multiple user resources, you will need to define
|
|
multiple user identity resources.
|
|
|
|
|
|
## user_identity
|
|
Configure identity options for this resource
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Options
|
|
|
|
| Name | Type | Default | Docs |
|
|
|------|------|---------|------|
|
|
| [`api`](#user_identity-api){: #user_identity-api .spark-required} | `module` | | The Ash API to use to access this resource. |
|
|
| [`user_resource`](#user_identity-user_resource){: #user_identity-user_resource .spark-required} | `module` | | The user resource to which these identities belong. |
|
|
| [`uid_attribute_name`](#user_identity-uid_attribute_name){: #user_identity-uid_attribute_name } | `atom` | `:uid` | The name of the `uid` attribute on this resource. |
|
|
| [`strategy_attribute_name`](#user_identity-strategy_attribute_name){: #user_identity-strategy_attribute_name } | `atom` | `:strategy` | The name of the `strategy` attribute on this resource. |
|
|
| [`user_id_attribute_name`](#user_identity-user_id_attribute_name){: #user_identity-user_id_attribute_name } | `atom` | `:user_id` | The name of the `user_id` attribute on this resource. |
|
|
| [`access_token_attribute_name`](#user_identity-access_token_attribute_name){: #user_identity-access_token_attribute_name } | `atom` | `:access_token` | The name of the `access_token` attribute on this resource. |
|
|
| [`access_token_expires_at_attribute_name`](#user_identity-access_token_expires_at_attribute_name){: #user_identity-access_token_expires_at_attribute_name } | `atom` | `:access_token_expires_at` | The name of the `access_token_expires_at` attribute on this resource. |
|
|
| [`refresh_token_attribute_name`](#user_identity-refresh_token_attribute_name){: #user_identity-refresh_token_attribute_name } | `atom` | `:refresh_token` | The name of the `refresh_token` attribute on this resource. |
|
|
| [`upsert_action_name`](#user_identity-upsert_action_name){: #user_identity-upsert_action_name } | `atom` | `:upsert` | The name of the action used to create and update records. |
|
|
| [`destroy_action_name`](#user_identity-destroy_action_name){: #user_identity-destroy_action_name } | `atom` | `:destroy` | The name of the action used to destroy records. |
|
|
| [`read_action_name`](#user_identity-read_action_name){: #user_identity-read_action_name } | `atom` | `:read` | The name of the action used to query identities. |
|
|
| [`user_relationship_name`](#user_identity-user_relationship_name){: #user_identity-user_relationship_name } | `atom` | `:user` | The name of the belongs-to relationship between identities and users. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style type="text/css">.spark-required::after { content: "*"; color: red !important; }</style>
|