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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🎨 Address @randomsamples' code review
 - Invert condition and blocks to put failure case last

 - Add comments about heuristics for re-auth and app-level MFA
  • Loading branch information
AlainODea committed Aug 21, 2018
commit 640053aafdac5dbe983feb036621eeba1e638d3c
10 changes: 7 additions & 3 deletions src/main/java/com/okta/tools/saml/OktaSaml.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,24 @@ private String getSamlResponseForAwsFromDocument(Document document) {
} else {
Elements errorContent = document.getElementsByClass("error-content");
Elements errorHeadline = errorContent.select("h1");
if (errorHeadline.isEmpty()) {
throw new RuntimeException("You do not have access to AWS through Okta. \nPlease contact your administrator.");
} else {
if (errorHeadline.hasText()) {
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 🎉

}
}
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.

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?

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?


// Heuristic based on undocumented behavior observed experimentally
// This condition may be missed if Okta significantly changes the app-level MFA page
private boolean isPromptForFactorChallenge(Document document) {
return document.getElementById("okta-sign-in") != null;
}
Expand Down