Skip to content

Commit 5b08998

Browse files
author
Tareq Abedrabbo
committed
SWS-524 - Wss4j security header validation: make header elements check overriddable
1 parent b83432a commit 5b08998

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

security/src/main/java/org/springframework/ws/soap/security/wss4j/Wss4jSecurityInterceptor.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,7 @@ protected void validateMessage(SoapMessage soapMessage, MessageContext messageCo
519519
throw new Wss4jSecurityValidationException("No WS-Security header found");
520520
}
521521

522-
if (!handler.checkReceiverResults(results, validationActionsVector)) {
523-
throw new Wss4jSecurityValidationException("Security processing failed (actions mismatch)");
524-
}
522+
checkResults(results, validationActionsVector);
525523

526524
// puts the results in the context
527525
// useful for Signature Confirmation
@@ -542,6 +540,20 @@ protected void validateMessage(SoapMessage soapMessage, MessageContext messageCo
542540
soapMessage.getEnvelope().getHeader().removeHeaderElement(WS_SECURITY_NAME);
543541
}
544542

543+
/**
544+
* Checks whether the received headers match the configured validation actions. Subclasses could override this method
545+
* for custom verification behavior.
546+
* @param results the results of the validation function
547+
* @param validationActionsVector the decoded validation actions
548+
* @throws Wss4jSecurityValidationException if the results are deemed invalid
549+
*/
550+
protected void checkResults(Vector results, Vector validationActionsVector)
551+
throws Wss4jSecurityValidationException {
552+
if (!handler.checkReceiverResults(results, validationActionsVector)) {
553+
throw new Wss4jSecurityValidationException("Security processing failed (actions mismatch)");
554+
}
555+
}
556+
545557
/**
546558
* Puts the results of WS-Security headers processing in the message context. Some actions like Signature
547559
* Confirmation require this.

0 commit comments

Comments
 (0)