Skip to content

Commit

Permalink
Fix secondary oob otp setup always skipped
Browse files Browse the repository at this point in the history
ref DEV-1344
  • Loading branch information
louischan-oursky committed May 30, 2024
2 parents 7b3fb15 + 286f60f commit be8bc1a
Show file tree
Hide file tree
Showing 6 changed files with 568 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Account linking login and link with identification email after it
authgear.yaml:
override: |
test_mode:
oob_otp:
enabled: true
rules:
- fixed_code: "aaaaaa"
regex: ".*"
authentication:
identities:
- login_id
Expand Down
349 changes: 349 additions & 0 deletions e2e/tests/account_linking/login_and_link_skip_create_oob_otp.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
name: Account linking login and link with secondary oob otp setup skipped
authgear.yaml:
override: |
authentication:
identities:
- login_id
- oauth
identity:
oauth:
providers:
- alias: google
client_id: "google"
type: google
account_linking:
oauth:
- alias: google
action: login_and_link
oauth_claim:
pointer: "/email"
user_profile:
pointer: "/email"
authentication_flow:
signup_flows:
- name: f1
steps:
- type: identify
name: identify_email
one_of:
- identification: email
steps:
- type: identify
one_of:
- identification: oauth
steps:
# This step should be skipped because the email in step "identify_email" will not be created
- type: create_authenticator
one_of:
- authentication: secondary_oob_otp_email
target_step: identify_email
login_flows:
- name: f1
steps:
- name: identify
type: identify
one_of:
- identification: oauth
- identification: email
steps:
- type: authenticate
one_of:
- authentication: primary_password
before:
- type: user_import
user_import: email_users.json
steps:
- action: "create"
input: |
{
"type": "signup",
"name": "f1"
}
output:
result: |
{
"action": {
"type": "identify"
}
}
- action: input
input: |
{
"identification": "email",
"login_id": "[email protected]"
}
output:
result: |
{
"action": {
"type": "identify"
}
}
- action: input
input: |
{
"identification": "oauth",
"alias": "google",
"redirect_uri": "http://mock"
}
output:
result: |
{
"action": {
"type": "identify",
"data": {
"oauth_authorization_url": "[[string]]"
}
}
}
- action: oauth_redirect
to: "{{ .prev.result.action.data.oauth_authorization_url }}"
redirect_uri: http://mock
output:
result: |
{
"query": "[[string]]"
}
- action: input
input: |
{
"query": "{{ .prev.result.query }}"
}
output:
result: |
{
"action": {
"type": "identify",
"identification": "oauth",
"data": {
"type": "account_linking_identification_data"
}
}
}
- action: input
input: |
{
"index": 0
}
output:
result: |
{
"action": {
"type": "authenticate",
"data": {
"type": "authentication_data"
}
}
}
- action: input
input: |
{
"authentication": "primary_password",
"password": "12341234"
}
output:
result: |
{
"action": {
"type": "finished"
}
}
---
name: Account linking login and link with secondary oob otp setup not skipped
authgear.yaml:
override: |
authenticator:
oob_otp:
email:
email_otp_mode: code
authentication:
identities:
- login_id
- oauth
identity:
oauth:
providers:
- alias: google
client_id: "google"
type: google
account_linking:
oauth:
- alias: google
action: login_and_link
oauth_claim:
pointer: "/email"
user_profile:
pointer: "/email"
authentication_flow:
signup_flows:
- name: f1
steps:
- type: identify
name: identify_email
one_of:
- identification: email
steps:
- type: identify
one_of:
- identification: oauth
steps:
# This step should NOT be skipped because target is not specified
- type: create_authenticator
one_of:
- authentication: secondary_oob_otp_email
login_flows:
- name: f1
steps:
- name: identify
type: identify
one_of:
- identification: oauth
- identification: email
steps:
- type: authenticate
one_of:
- authentication: primary_password
before:
- type: user_import
user_import: email_users.json
steps:
- action: "create"
input: |
{
"type": "signup",
"name": "f1"
}
output:
result: |
{
"action": {
"type": "identify"
}
}
- action: input
input: |
{
"identification": "email",
"login_id": "[email protected]"
}
output:
result: |
{
"action": {
"type": "identify"
}
}
- action: input
input: |
{
"identification": "oauth",
"alias": "google",
"redirect_uri": "http://mock"
}
output:
result: |
{
"action": {
"type": "identify",
"data": {
"oauth_authorization_url": "[[string]]"
}
}
}
- action: oauth_redirect
to: "{{ .prev.result.action.data.oauth_authorization_url }}"
redirect_uri: http://mock
output:
result: |
{
"query": "[[string]]"
}
- action: input
input: |
{
"query": "{{ .prev.result.query }}"
}
output:
result: |
{
"action": {
"type": "identify",
"identification": "oauth",
"data": {
"type": "account_linking_identification_data"
}
}
}
- action: input
input: |
{
"index": 0
}
output:
result: |
{
"action": {
"type": "authenticate",
"data": {
"type": "authentication_data"
}
}
}
- action: input
input: |
{
"authentication": "primary_password",
"password": "12341234"
}
output:
result: |
{
"action": {
"type": "create_authenticator"
}
}
- action: input
input: |
{
"authentication": "secondary_oob_otp_email",
"target": "[email protected]"
}
output:
result: |
{
"action": {
"type": "create_authenticator",
"authentication": "secondary_oob_otp_email",
"data": {
"type": "verify_oob_otp_data",
"otp_form": "code"
}
}
}
- action: input
input: |
{
"code": "111111"
}
output:
result: |
{
"action": {
"type": "finished"
}
}
Loading

0 comments on commit be8bc1a

Please sign in to comment.