From 59f3ae0b6789628365c605e2d2188f89ae0992de Mon Sep 17 00:00:00 2001 From: elfogre Date: Tue, 2 Jan 2018 17:38:37 +0100 Subject: [PATCH] Allow to sign SOAP attachments See gh-107 --- .../security/wss4j2/Wss4jSecurityInterceptor.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spring-ws-security/src/main/java/org/springframework/ws/soap/security/wss4j2/Wss4jSecurityInterceptor.java b/spring-ws-security/src/main/java/org/springframework/ws/soap/security/wss4j2/Wss4jSecurityInterceptor.java index b0f1648d..45c6ea60 100644 --- a/spring-ws-security/src/main/java/org/springframework/ws/soap/security/wss4j2/Wss4jSecurityInterceptor.java +++ b/spring-ws-security/src/main/java/org/springframework/ws/soap/security/wss4j2/Wss4jSecurityInterceptor.java @@ -199,6 +199,8 @@ public class Wss4jSecurityInterceptor extends AbstractWsSecurityInterceptor impl private CallbackHandler samlCallbackHandler; + private CallbackHandler attachmentCallbackHandler; + // Allow RSA 15 to maintain default behavior private boolean allowRSA15KeyTransportAlgorithm = true; @@ -458,6 +460,14 @@ public class Wss4jSecurityInterceptor extends AbstractWsSecurityInterceptor impl this.samlCallbackHandler = samlCallbackHandler; } + /** + * Sets the attachment callback handler used for SwA signature/encryption + * @param attachmentCallbackHandler + */ + public void setAttachmentCallbackHandler (CallbackHandler attachmentCallbackHandler) { + this.attachmentCallbackHandler = attachmentCallbackHandler; + } + /** * Sets the server-side time to live. */ @@ -705,6 +715,8 @@ public class Wss4jSecurityInterceptor extends AbstractWsSecurityInterceptor impl requestData.setWssConfig(this.wssConfig); + requestData.setAttachmentCallbackHandler(attachmentCallbackHandler); + messageContext.setProperty(WSHandlerConstants.TTL_TIMESTAMP, Integer.toString(this.securementTimeToLive)); if (this.samlCallbackHandler != null) {