-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e test for setting up secondary oob otp in account linking
- Loading branch information
Showing
1 changed file
with
349 additions
and
0 deletions.
There are no files selected for viewing
349 changes: 349 additions & 0 deletions
349
e2e/tests/account_linking/login_and_link_skip_create_oob_otp.test.yaml
This file contains 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,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" | ||
} | ||
} |