Skip to content
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

feat: return verification flow ID after registration flow #3144

Merged
merged 8 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: "1.19"

- name: Install selfservice-ui-react-native
uses: actions/checkout@v3
with:
Expand All @@ -179,6 +180,7 @@ jobs:
- run: |
cd react-native-ui
npm install

- name: Install selfservice-ui-node
uses: actions/checkout@v3
with:
Expand All @@ -187,14 +189,26 @@ jobs:
- run: |
cd node-ui
npm install

- name: Install selfservice-ui-react-nextjs
uses: actions/checkout@v3
with:
repository: ory/kratos-selfservice-ui-react-nextjs
path: react-ui
- run: |
cd react-ui
npm ci

- run: |
echo 'RN_UI_PATH='"$(realpath react-native-ui)" >> $GITHUB_ENV
echo 'NODE_UI_PATH='"$(realpath node-ui)" >> $GITHUB_ENV
echo 'REACT_UI_PATH='"$(realpath react-ui)" >> $GITHUB_ENV
- run: |
./test/e2e/run.sh ${{ matrix.database }}
env:
RN_UI_PATH: react-native-ui
NODE_UI_PATH: node-ui
REACT_UI_PATH: react-ui
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
- if: failure()
uses: actions/upload-artifact@v2
Expand Down
14 changes: 14 additions & 0 deletions .schema/openapi/patches/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,17 @@

- op: remove
path: "#/components/schemas/identityTraits/type"

- op: add
path: /components/schemas/continueWith/discriminator
value:
propertyName: action
mapping:
show_verification_ui: "#/components/schemas/continueWithVerificationUi"
set_ory_session_token: "#/components/schemas/continueWithSetOrySessionToken"

- op: add
path: /components/schemas/continueWith/oneOf
value:
- "$ref": "#/components/schemas/continueWithVerificationUi"
- "$ref": "#/components/schemas/continueWithSetOrySessionToken"
1 change: 1 addition & 0 deletions contrib/quickstart/kratos/email-password/kratos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ selfservice:
password:
hooks:
- hook: session
- hook: show_verification_ui

log:
level: debug
Expand Down
2 changes: 1 addition & 1 deletion driver/config/stub/.kratos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ selfservice:
body: /path/to/template.jsonnet

settings:
ui_url: http://test.kratos.ory.sh/settings
ui_url: http://test.kratos.ory.sh/settings
lifespan: 99m
privileged_session_max_age: 5m
after:
Expand Down
9 changes: 5 additions & 4 deletions driver/registry_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ type RegistryDefault struct {
persister persistence.Persister
migrationStatus popx.MigrationStatuses

hookVerifier *hook.Verifier
hookSessionIssuer *hook.SessionIssuer
hookSessionDestroyer *hook.SessionDestroyer
hookAddressVerifier *hook.AddressVerifier
hookVerifier *hook.Verifier
hookSessionIssuer *hook.SessionIssuer
hookSessionDestroyer *hook.SessionDestroyer
hookAddressVerifier *hook.AddressVerifier
hookShowVerificationUI *hook.ShowVerificationUIHook

identityHandler *identity.Handler
identityValidator *identity.Validator
Expand Down
9 changes: 9 additions & 0 deletions driver/registry_default_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ func (m *RegistryDefault) HookAddressVerifier() *hook.AddressVerifier {
return m.hookAddressVerifier
}

func (m *RegistryDefault) HookShowVerificationUI() *hook.ShowVerificationUIHook {
if m.hookShowVerificationUI == nil {
m.hookShowVerificationUI = hook.NewShowVerificationUIHook(m)
}
return m.hookShowVerificationUI
}

func (m *RegistryDefault) WithHooks(hooks map[string]func(config.SelfServiceHook) interface{}) {
m.injectedSelfserviceHooks = hooks
}
Expand All @@ -51,6 +58,8 @@ func (m *RegistryDefault) getHooks(credentialsType string, configs []config.Self
i = append(i, hook.NewWebHook(m, h.Config))
case hook.KeyAddressVerifier:
i = append(i, m.HookAddressVerifier())
case hook.KeyVerificationUI:
i = append(i, m.HookShowVerificationUI())
default:
var found bool
for name, m := range m.injectedSelfserviceHooks {
Expand Down
13 changes: 13 additions & 0 deletions driver/registry_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,19 @@ func TestDriverDefault_Hooks(t *testing.T) {
}
},
},
{
uc: "show_verification_ui is configured",
prep: func(conf *config.Config) {
conf.MustSet(ctx, config.ViperKeySelfServiceRegistrationAfter+".hooks", []map[string]interface{}{
{"hook": "show_verification_ui"},
})
},
expect: func(reg *driver.RegistryDefault) []registration.PostHookPostPersistExecutor {
return []registration.PostHookPostPersistExecutor{
hook.NewShowVerificationUIHook(reg),
}
},
},
} {
t.Run(fmt.Sprintf("after/uc=%s", tc.uc), func(t *testing.T) {
conf, reg := internal.NewVeryFastRegistryWithoutDB(t)
Expand Down
17 changes: 16 additions & 1 deletion embedx/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@
"hook"
]
},
"selfServiceShowVerificationUIHook": {
"type": "object",
"properties": {
"hook": {
"const": "show_verification_ui"
}
},
"additionalProperties": false,
"required": [
"hook"
]
},
"webHookAuthBasicAuthProperties": {
"properties": {
"type": {
Expand Down Expand Up @@ -744,6 +756,9 @@
},
{
"$ref": "#/definitions/selfServiceWebHook"
},
{
"$ref": "#/definitions/selfServiceShowVerificationUIHook"
}
]
},
Expand Down Expand Up @@ -2647,4 +2662,4 @@
"selfservice"
],
"additionalProperties": false
}
}
3 changes: 1 addition & 2 deletions identity/identity_verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ type VerifiableAddress struct {

// IdentityID is a helper struct field for gobuffalo.pop.
IdentityID uuid.UUID `json:"-" faker:"-" db:"identity_id"`
// CreatedAt is a helper struct field for gobuffalo.pop.
NID uuid.UUID `json:"-" faker:"-" db:"nid"`
NID uuid.UUID `json:"-" faker:"-" db:"nid"`
}

func (v VerifiableAddressType) HTMLFormInputType() string {
Expand Down
8 changes: 8 additions & 0 deletions internal/client-go/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ api_metadata.go
client.go
configuration.go
docs/AuthenticatorAssuranceLevel.md
docs/ContinueWith.md
docs/ContinueWithSetOrySessionToken.md
docs/ContinueWithVerificationUi.md
docs/ContinueWithVerificationUiFlow.md
docs/CourierApi.md
docs/CourierMessageStatus.md
docs/CourierMessageType.md
Expand Down Expand Up @@ -113,6 +117,10 @@ git_push.sh
go.mod
go.sum
model_authenticator_assurance_level.go
model_continue_with.go
model_continue_with_set_ory_session_token.go
model_continue_with_verification_ui.go
model_continue_with_verification_ui_flow.go
model_courier_message_status.go
model_courier_message_type.go
model_create_identity_body.go
Expand Down
4 changes: 4 additions & 0 deletions internal/client-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ Class | Method | HTTP request | Description
## Documentation For Models

- [AuthenticatorAssuranceLevel](docs/AuthenticatorAssuranceLevel.md)
- [ContinueWith](docs/ContinueWith.md)
- [ContinueWithSetOrySessionToken](docs/ContinueWithSetOrySessionToken.md)
- [ContinueWithVerificationUi](docs/ContinueWithVerificationUi.md)
- [ContinueWithVerificationUiFlow](docs/ContinueWithVerificationUiFlow.md)
- [CourierMessageStatus](docs/CourierMessageStatus.md)
- [CourierMessageType](docs/CourierMessageType.md)
- [CreateIdentityBody](docs/CreateIdentityBody.md)
Expand Down
146 changes: 146 additions & 0 deletions internal/client-go/model_continue_with.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading