use of org.pac4j.saml.exceptions.SAMLSignatureRequiredException in project pac4j by pac4j.
the class SAML2DefaultResponseValidator method validateAssertionSignature.
/**
* Validate assertion signature. If none is found and the SAML response did not have one and the SP requires
* the assertions to be signed, the validation fails.
*
* @param signature the signature
* @param context the context
* @param engine the engine
*/
protected final void validateAssertionSignature(final Signature signature, final SAML2MessageContext context, final SignatureTrustEngine engine) {
final SAMLPeerEntityContext peerContext = context.getSAMLPeerEntityContext();
if (signature != null) {
final String entityId = peerContext.getEntityId();
validateSignature(signature, entityId, engine);
} else {
if (wantsAssertionsSigned(context) && !peerContext.isAuthenticated()) {
throw new SAMLSignatureRequiredException("Assertion or response must be signed");
}
}
}
use of org.pac4j.saml.exceptions.SAMLSignatureRequiredException in project pac4j by pac4j.
the class SAML2LogoutResponseValidator method validateAssertionSignature.
/**
* Validate assertion signature. If none is found and the SAML response did not have one and the SP requires
* the assertions to be signed, the validation fails.
*
* @param signature the signature
* @param context the context
* @param engine the engine
*/
protected final void validateAssertionSignature(final Signature signature, final SAML2MessageContext context, final SignatureTrustEngine engine) {
final SAMLPeerEntityContext peerContext = context.getSAMLPeerEntityContext();
if (signature != null) {
final String entityId = peerContext.getEntityId();
validateSignature(signature, entityId, engine);
} else {
if (!peerContext.isAuthenticated()) {
throw new SAMLSignatureRequiredException("Assertion or response must be signed");
}
}
}
Aggregations