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

🎨 Clearer app sign on rule failure messages #180

Merged
merged 3 commits into from
Aug 22, 2018

Conversation

AlainODea
Copy link
Collaborator

Problem Statement

When app sign on policies are unsupported the tool responds like this:

You do not have access to AWS through Okta.
Please contact your administrator.

That is inaccurate and confusing and leads to issue reports that would be better handled as feature requests with use cases outlined.

Solution

  • Differentiate sign-on failure due to app-level MFA

  • Differentiate sign-on failure due to app-level re-auth challenge

  • Use failure message from Okta when available otherwise

 - Differentiate sign-on failure due to app-level MFA

 - Differentiate sign-on failure due to app-level re-auth challenge

 - Use failure message from Okta when available otherwise
@AlainODea
Copy link
Collaborator Author

@randomsamples I was inspired by your work in #172 to take this a little further. Can you give this a code review for me?

} else {
Elements errorContent = document.getElementsByClass("error-content");
Elements errorHeadline = errorContent.select("h1");
if (errorHeadline.isEmpty()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would invert this conditional so that the failure case (no error-content nodes) is last in the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I will do that. Thank you.

}
return samlResponseInputElement.attr("value");
}

private boolean isPasswordAuthenticationChallenge(Document document) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be helpful if we could point to the API docs where these strings are defined?

 - Invert condition and blocks to put failure case last

 - Add comments about heuristics for re-auth and app-level MFA
// This condition may be missed Okta significantly changes the app-level re-auth page
private boolean isPasswordAuthenticationChallenge(Document document) {
return document.getElementById("password-verification-challenge") != null;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@randomsamples hopefully the comments on these methods make up for the lack of documentation. The risk is mostly that the tool will incorrectly say that the user doesn't have app access if Okta changes these pages (the current behavior prior to this change). Is that an acceptable compromise?

throw new RuntimeException(errorHeadline.text());
} else {
throw new RuntimeException("You do not have access to AWS through Okta. \nPlease contact your administrator.");
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@randomsamples this is much cleaner with your suggestions. Thank you 🎉

@AlainODea
Copy link
Collaborator Author

@randomsamples can you give this one last once over to see that I've addressed your concerns?

Copy link

@randomsamples randomsamples left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. The comments are helpful, and at the end of the day it’s a win if it works!

}
return samlResponseInputElement.attr("value");
}

// Heuristic based on undocumented behavior observed experimentally
// This condition may be missed Okta significantly changes the app-level re-auth page

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‘’missed if”

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll fix that and merge. Thank you for code reviews.

@AlainODea AlainODea merged commit 534ed12 into oktadev:master Aug 22, 2018
@AlainODea AlainODea deleted the ao-ART-clarify-app-sign-on-errors branch September 29, 2018 16:19
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.

None yet

2 participants