-
Notifications
You must be signed in to change notification settings - Fork 322
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
Fix redirect for IDV/IDP flow for OV enrollment on Android #3782
Open
denysoblohin-okta
wants to merge
7
commits into
master
Choose a base branch
from
od-fix-OKTA-856187
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b8551e2
Gen2: Add useRedirectButton
denysoblohin-okta 27bf6bd
add test
denysoblohin-okta b478117
enable test
denysoblohin-okta 078fd58
add idp flow test
denysoblohin-okta db7653e
fix unit test and lint
denysoblohin-okta 1465801
fix unit test
denysoblohin-okta 564ef12
address comment
denysoblohin-okta 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 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
126 changes: 126 additions & 0 deletions
126
...round/mocks/data/idp/idx/authenticator-verification-idp-for-ov-enrollment-on-android.json
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,126 @@ | ||
{ | ||
"stateHandle": "02TptqPN4BOLIwMAGUVLPlZVJEnONAq7xkg19dy6Gk", | ||
"version": "1.0.0", | ||
"expiresAt": "2021-01-19T15:10:35.000Z", | ||
"intent": "LOGIN", | ||
"remediation": { | ||
"type": "array", | ||
"value": [ | ||
{ | ||
"name": "redirect-idp", | ||
"type": "OIDC", | ||
"idp": { | ||
"id": "0oa69chx4bZyx8O7l0g4", | ||
"name": "IDP Authenticator" | ||
}, | ||
"href": "http://localhost:3000/sso/idps/0oa69chx4bZyx8O7l0g4?stateToken=02TptqPN4BOLIwMAGUVLPlZVJEnONAq7xkg19dy6Gk", | ||
"method": "GET", | ||
"relatesTo" : [ "$.currentAuthenticatorEnrollment" ] | ||
} | ||
] | ||
}, | ||
"currentAuthenticatorEnrollment": { | ||
"type": "object", | ||
"value": { | ||
"key": "external_idp", | ||
"type": "federated", | ||
"id": "aut4mhtS1b84AR0iQ0g4", | ||
"displayName": "IDP Authenticator", | ||
"methods": [ | ||
{ "type": "idp" } | ||
] | ||
} | ||
}, | ||
"currentAuthenticator": { | ||
"type": "object", | ||
"value": { | ||
"key": "external_idp", | ||
"type": "federated", | ||
"id": "aut4mhtS1b84AR0iQ0g4", | ||
"displayName": "IDP Authenticator", | ||
"methods": [ | ||
{ "type": "idp" } | ||
] | ||
} | ||
}, | ||
"authenticators": { | ||
"type": "array", | ||
"value": [ | ||
{ | ||
"key": "external_idp", | ||
"type": "federated", | ||
"id": "aut4mhtS1b84AR0iQ0g4", | ||
"displayName": "IDP Authenticator", | ||
"methods": [ | ||
{ "type": "idp" } | ||
] | ||
} | ||
] | ||
}, | ||
"authenticatorEnrollments": { | ||
"type": "array", | ||
"value": [ | ||
{ | ||
"profile": { "provider": "Custom OIDC Provider" }, | ||
"type": "federated", | ||
"key": "external_idp", | ||
"id": "aut4mhtS1b84AR0iQ0g4", | ||
"displayName": "IDP Authenticator", | ||
"methods": [ | ||
{ "type": "idp" } | ||
] | ||
} | ||
] | ||
}, | ||
"user": { | ||
"type": "object", | ||
"value": { "id": "00u2m55pu8UZyeMMl0g4", "identifier": "[email protected]" } | ||
}, | ||
"cancel": { | ||
"rel": [ "create-form" ], | ||
"name": "cancel", | ||
"href": "http://localhost:3000/idp/idx/cancel", | ||
"method": "POST", | ||
"value": [ | ||
{ | ||
"name": "stateHandle", | ||
"required": true, | ||
"value": "02TptqPN4BOLIwMAGUVLPlZVJEnONAq7xkg19dy6Gk", | ||
"visible": false, | ||
"mutable": false | ||
} | ||
], | ||
"accepts": "application/ion+json; okta-version=1.0.0" | ||
}, | ||
"app": { | ||
"type": "object", | ||
"value": { | ||
"name": "Okta_Authenticator", | ||
"label": "Okta Authenticator", | ||
"id": "BDSC3453323dsdfS" | ||
} | ||
}, | ||
"authentication": { | ||
"type": "object", | ||
"value": { | ||
"protocol": "OAUTH2.0", | ||
"issuer": { | ||
"name": "Test App", | ||
"uri": "http://localhost:3000" | ||
}, | ||
"request": { | ||
"max_age": -1, | ||
"scope": "openid profile email okta.authenticators.read okta.authenticators.manage.self", | ||
"display": "page", | ||
"response_type": "code", | ||
"redirect_uri": "https://login.okta.com/oauth/callback", | ||
"state": "i41VVuProw96htTUmvRP9A", | ||
"code_challenge_method": "S256", | ||
"nonce": "ASDF4343SDFS3-GhS8SQCw", | ||
"code_challenge": "abcd_8asd8asdf8as98fasdf_-_9sadif9rasd9fasdf-cc", | ||
"response_mode": "query" | ||
} | ||
} | ||
} | ||
} | ||
|
84 changes: 84 additions & 0 deletions
84
...ata/idp/idx/authenticator-verification-idp-with-persona-for-ov-enrollment-on-android.json
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,84 @@ | ||
{ | ||
"version": "1.0.0", | ||
"stateHandle": "02.id.94zt8uHWhX3pnDTehDQyqBGcoUhlDrEDvrwOIUYe", | ||
"expiresAt": "2024-08-01T17:57:28.000Z", | ||
"intent": "CREDENTIAL_ENROLLMENT", | ||
"remediation": { | ||
"type": "array", | ||
"value": [ | ||
{ | ||
"name": "redirect-idverify", | ||
"type": "ID_PROOFING", | ||
"href": "http://localhost:3000/idp/identity-verification?stateTokenExternalId=bzJOSnhodWVNZjZuVEsrUj", | ||
"method": "GET", | ||
"idp": { | ||
"id": "IDV_PERSONA", | ||
"name": "Persona" | ||
} | ||
} | ||
] | ||
}, | ||
"user": { | ||
"type": "object", | ||
"value": { | ||
"id": "00ujkgu115wtBLr0Z0g4", | ||
"identifier": "[email protected]", | ||
"profile": { | ||
"firstName": "admin", | ||
"lastName": "admin", | ||
"timeZone": "America/Los_Angeles", | ||
"locale": "en_US", | ||
"email": "a***[email protected]" | ||
} | ||
} | ||
}, | ||
"cancel": { | ||
"rel": [ | ||
"create-form" | ||
], | ||
"name": "cancel", | ||
"href": "https://idp.okta1.com/idp/idx/cancel", | ||
"method": "POST", | ||
"produces": "application/ion+json; okta-version=1.0.0", | ||
"value": [ | ||
{ | ||
"name": "stateHandle", | ||
"required": true, | ||
"value": "02.id.94zt8uHWhX3pnDTehDQyqBGcoUhlDrEDvrwOIUYe", | ||
"visible": false, | ||
"mutable": false | ||
} | ||
], | ||
"accepts": "application/json; okta-version=1.0.0" | ||
}, | ||
"app": { | ||
"type": "object", | ||
"value": { | ||
"name": "Okta_Authenticator", | ||
"label": "Okta Authenticator", | ||
"id": "BDSC3453323dsdfS" | ||
} | ||
}, | ||
"authentication": { | ||
"type": "object", | ||
"value": { | ||
"protocol": "OAUTH2.0", | ||
"issuer": { | ||
"name": "Test App", | ||
"uri": "http://localhost:3000" | ||
}, | ||
"request": { | ||
"max_age": -1, | ||
"scope": "openid profile email okta.authenticators.read okta.authenticators.manage.self", | ||
"display": "page", | ||
"response_type": "code", | ||
"redirect_uri": "https://login.okta.com/oauth/callback", | ||
"state": "i41VVuProw96htTUmvRP9A", | ||
"code_challenge_method": "S256", | ||
"nonce": "ASDF4343SDFS3-GhS8SQCw", | ||
"code_challenge": "abcd_8asd8asdf8as98fasdf_-_9sadif9rasd9fasdf-cc", | ||
"response_mode": "query" | ||
} | ||
} | ||
} | ||
} |
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
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
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 |
---|---|---|
|
@@ -16,7 +16,7 @@ const Body = BaseForm.extend({ | |
const user = this.options.appState.get('user'); | ||
|
||
// OKTA-635926: add user gesture for ov enrollment on android | ||
if (Util.isAndroidOVEnrollment(this.options.appState.get('authentication'))) { | ||
if (this.useRedirectButton()) { | ||
titleString = loc('oie.success.text.signingIn.with.appName.android.ov.enrollment', 'login'); | ||
return titleString; | ||
} | ||
|
@@ -71,12 +71,25 @@ const Body = BaseForm.extend({ | |
BaseForm.prototype.initialize.apply(this, arguments); | ||
this.redirectView = this.settings.get('interstitialBeforeLoginRedirect'); | ||
this.model.set('useRedirect', true); | ||
if (this.useRedirectButton()) { | ||
this.model.set('useRedirectButton', true); | ||
} | ||
this.trigger('save', this.model); | ||
}, | ||
|
||
useRedirectButton() { | ||
const idx = this.options.appState.get('idx'); | ||
const isAndroidOVEnrollment = Util.isAndroidOVEnrollment(this.options.appState.get('authentication')); | ||
// Do not show "Open Okta Verify" button for "redirect-idp" remediation | ||
// converted to "success-redirect" with `convertRedirectIdPToSuccessRedirectIffOneIdp()` | ||
// (Which can happen if there is a IdP route configured for a user) | ||
const isSuccessRedirect = idx?.rawIdxState?.success?.href; | ||
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. Without this fix it will show unnecessary page with "Open Okta Verify" button before redirect to IDP (not IDP authenticator). screen-20250204-204028.mp4 |
||
return isAndroidOVEnrollment && isSuccessRedirect; | ||
}, | ||
|
||
render() { | ||
BaseForm.prototype.render.apply(this, arguments); | ||
if (Util.isAndroidOVEnrollment(this.options.appState.get('authentication'))) { | ||
if (this.useRedirectButton()) { | ||
const currentViewState = this.options.appState.getCurrentViewState(); | ||
this.add(createButton({ | ||
className: 'ul-button button button-wide button-primary hide-underline', | ||
|
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
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
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
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
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.
I think we need to move this down into the
else
conditional and also copy it into theAutoRedirectView
, because if the user is shown the redirect button (didn't get auto-redirected) but then refreshes the page for some reason, they will get returned to introspect rather than have the state preserved.