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

Validate the JSON response status when MFA push polling #1

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

bleathem
Copy link

Problem Statement

https://thumbtack.atlassian.net/browse/DX-1219

When a user's okta password is expired, Push verification fails with a cryptic JSON parse error:

Exception in thread "main" org.json.JSONException: JSONObject["factorResult"] not found.
at org.json.JSONObject.get(JSONObject.java:572)
at org.json.JSONObject.getString(JSONObject.java:859)
at com.okta.tools.authentication.OktaMFA.handlePushPolling(OktaMFA.java:307)
at com.okta.tools.authentication.OktaMFA.verifyAnswer(OktaMFA.java:285)
at com.okta.tools.authentication.OktaMFA.pushFactor(OktaMFA.java:242)
at com.okta.tools.authentication.OktaMFA.getSessionToken(OktaMFA.java:103)
at com.okta.tools.authentication.OktaMFA.promptForFactor(OktaMFA.java:64)
at com.okta.tools.authentication.OktaAuthentication.getOktaSessionToken(OktaAuthentication.java:87)
at com.okta.tools.saml.OktaSaml.getSamlResponse(OktaSaml.java:47)
at com.okta.tools.OktaAwsCliAssumeRole.doRequest(OktaAwsCliAssumeRole.java:132)
at com.okta.tools.OktaAwsCliAssumeRole.run(OktaAwsCliAssumeRole.java:102)
at com.okta.tools.WithOkta.main(WithOkta.java:28)

Solution

We can use the existing validateStatus method to validate the status of the json response for each poll response.

@bleathem
Copy link
Author

Upstream PR:
oktadev#414

@bleathem
Copy link
Author

Tested locally using okta accounts with both expired and unexpired statuses.

@bleathem bleathem merged commit 5b88bae into main Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant