Skip to content

Commit 93049ec

Browse files
committed
Provide a setter for validationException
If a subclass needs to extend isValid(String), it must be able to set the validation exception. In fact, overriding any of the non-private validateXXX methods is trivial, because a ValidationError can simply be thrown, but if additional validation is required, which is not covered by any of those validateXXX methods, a subclass may need to override isValid(String) directly, and this does not throw ValidationError, but rather catches it so that it can be subsequently returned by getValidationException() to the consumer. Hence, a setter with at least protected visibility is needed for subclasses to do the same.
1 parent 6589f28 commit 93049ec

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/src/main/java/com/onelogin/saml2/authn/SamlResponse.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,17 @@ public String getError() {
10221022
public Exception getValidationException() {
10231023
return validationException;
10241024
}
1025+
1026+
/**
1027+
* Sets the validation exception that this {@link SamlResponse} should return
1028+
* when a validation error occurs.
1029+
*
1030+
* @param validationException
1031+
* the validation exception to set
1032+
*/
1033+
protected void setValidationException(Exception validationException) {
1034+
this.validationException = validationException;
1035+
}
10251036

10261037
/**
10271038
* Extracts a node from the DOMDocument (Assertion).

0 commit comments

Comments
 (0)