-
Notifications
You must be signed in to change notification settings - Fork 401
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
Expose validation exception in SamlResponse #253
Expose validation exception in SamlResponse #253
Conversation
} | ||
return null; | ||
} | ||
|
||
/** | ||
* After execute a validation process, if fails this method returns the cause |
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.
After execute a validation process, if fails this method returns the Exception object
It's reasonable. You may update LogoutRequest and LogoutResponse as well And you should provide a getter to the Auth class in order to provide a similar method than getLastErrorReason , the method that returns the errorReason. You will see it updated on processResponse and processSLO -> 1 and 2 Test coverage for the new getValidationException methods should be provided as well |
@pitbulk thank you for the feedback, I will make those changes as soon as I have some spare time. For the test coverage, will it be sufficient to just have one test for each new
|
I understand 1 getValidationException per getError appearance is ideal, but you can simply cover the method. |
Also add unit tests for validation exceptions
@pitbulk updated with tests and additional exception getters as you described. |
Thanks for contributing |
@pitbulk no problem, thanks for the useful library :) |
Hi, we have a requirement in our product to take different actions based on the exact error with the SAML response (in our case, show the user different documentation pages on how they can fix the problem).
The best way I found to do this which doesn't rely on string matching was to expose the actual exception as in this PR, then use
ValidationException#getErrorCode
to drive the logic.I have not updated any tests yet, but am happy to do that if you agree this is an acceptable change.