Expose validation exception in SamlResponse#253
Expose validation exception in SamlResponse#253pitbulk merged 2 commits intoSAML-Toolkits:masterfrom
Conversation
| } | ||
|
|
||
| /** | ||
| * After execute a validation process, if fails this method returns the cause |
There was a problem hiding this comment.
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#getErrorCodeto drive the logic.I have not updated any tests yet, but am happy to do that if you agree this is an acceptable change.