public interface ValidationFailedHandler
XMLSignatureException
occurs
during calling XMLSignature.validate(javax.xml.crypto.dsig.XMLValidateContext)
.
This handler can be used to react in a specific way on validation failures. For example, the handler could write logs
or may even ignore certain validation failures.
Typically the handler throws an exception when a validation failure occurs. There is a certain order how the methods are called.
start()
is called when a core validation fails.
#signatureValueValidationFailed(SignatureValue)
is called if the signature validation fails.
referenceValidationFailed(Reference)
is called.
manifestReferenceValidationFailed(Reference)
is called.
ignoreCoreValidationFailure()
is called where you can finally decide whether the
processing should go on or be interrupted.
end()
is called at the end of the validation, even if the methods called
before have thrown an exception. This allows you to hold state between the start and end of the validation handling
process.
end()
method
is called in a finally block. Best practice is to interrupt the validation at the first occurrence of a validation
error.Modifier and Type | Method and Description |
---|---|
void |
end() |
boolean |
ignoreCoreValidationFailure()
If true is returned then the verifier will go-on as if there was no validation failure.
|
void |
manifestReferenceValidationFailed(Reference ref) |
Exception |
onXMLSignatureException(XMLSignatureException e)
Method called when an XMLSignatureException is thrown by the method
XMLSignature.validate(javax.xml.crypto.dsig.XMLValidateContext) . |
void |
referenceValidationFailed(Reference ref) |
void |
signatureValueValidationFailed(XMLSignature.SignatureValue value) |
void |
start() |
Exception onXMLSignatureException(XMLSignatureException e)
XMLSignature.validate(javax.xml.crypto.dsig.XMLValidateContext)
.
You can return more specific exceptions which are useful for your use-case.
e
- exceptionvoid start()
void signatureValueValidationFailed(XMLSignature.SignatureValue value) throws Exception
Exception
void referenceValidationFailed(Reference ref) throws Exception
Exception
void manifestReferenceValidationFailed(Reference ref) throws Exception
Exception
boolean ignoreCoreValidationFailure() throws Exception
XmlSignatureInvalidException
.
Best practice is to return false
to ensure that after a core validation failure, the verification
fails.
Exception
Apache Camel