-
Notifications
You must be signed in to change notification settings - Fork 423
feat: added first draft for identity schema selection #2270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7d4f5af
added first draft for identity schema selection
deepakprabhakara c1ec310
fixed link
deepakprabhakara cb0f7a8
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 7e65c59
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 667c640
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 b6792bc
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 cf8f00b
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 8cdc18b
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 f7bfdec
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 f29a0f3
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 3d61727
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 18b9afd
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 033f874
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 815c7f1
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 b65eacc
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 492db90
Update docs/identities/model/identity-schema-selection.mdx
unatasha8 8ee1005
chore: format document
piotrmsc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
id: identity-schema-selection | ||
title: Identity schema selection | ||
--- | ||
|
||
```mdx-code-block | ||
import Tabs from "@theme/Tabs" | ||
import TabItem from "@theme/TabItem" | ||
``` | ||
|
||
# Identity schema selection for self-service registration and login flows | ||
|
||
Ory Kratos now supports selecting an identity schema during registration and login self-service flows by specifying a | ||
query parameter. This gives administrators more control over which schemas are used and allows multi-tenant or multi-profile | ||
setups with distinct identity models. | ||
|
||
|
||
## Overview | ||
|
||
- Users or integrators can choose which schema to use by appending the `identity_schema` query parameter when initiating | ||
registration or login flows. | ||
- Only schemas explicitly marked as selectable via `selfservice_selectable: true` in the configuration will be accepted. | ||
- If no schema is selected, the default schema is used (this is the existing behavior). | ||
|
||
## How to use | ||
|
||
### Registration example | ||
|
||
####Browser flow:#### | ||
|
||
``` | ||
GET /self-service/registration/browser?identity_schema=schema-a | ||
``` | ||
|
||
**API flow:** | ||
unatasha8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
``` | ||
GET /self-service/registration/api?identity_schema=schema-a | ||
``` | ||
|
||
### Login Example | ||
|
||
**Browser flow:** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above
unatasha8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
``` | ||
GET /self-service/login/browser?identity_schema=schema-a | ||
``` | ||
|
||
**API flow:** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above
unatasha8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
``` | ||
GET /self-service/login/api?identity_schema=schema-a | ||
``` | ||
|
||
## Configuration | ||
|
||
You must define which schemas are available for self-service selection by using the `selfservice_selectable` flag in your identity | ||
schema configuration. | ||
|
||
### Example configuration | ||
|
||
```yaml | ||
identity: | ||
default_schema_id: default | ||
schemas: | ||
- id: default | ||
url: file://./schemas/default.schema.json | ||
selfservice_selectable: true | ||
|
||
- id: schema-a | ||
url: file://./schemas/schema-a.schema.json | ||
selfservice_selectable: true | ||
|
||
- id: schema-internal | ||
url: file://./schemas/internal.schema.json | ||
selfservice_selectable: false # This one cannot be selected by end users | ||
``` | ||
|
||
Only schemas where `selfservice_selectable: true` will be selectable via the `identity_schema` parameter. | ||
|
||
## Behavior Summary | ||
|
||
- If a schema is listed and marked as selectable, it can be used in registration/login. | ||
- If a schema is not listed or not marked as selectable, it cannot be used via query param. | ||
- If no `identity_schema` is passed, the default schema (`default_schema_id`) is used. | ||
|
||
## Migration notes | ||
|
||
- This feature is non-breaking. Existing flows using the default schema are unaffected. | ||
- You only need to update configuration if you want to expose multiple schemas for selection. | ||
- Schemas used internally can remain non-selectable, for example for admin or machine users. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above