Skip to content

Commit 65dc742

Browse files
committed
Add method in Wss4jSecurityInterceptor to allow setting ADD_INCLUSIVE_PREFIXES. This configuration was added in WSS4J 2.0.0 and sets whether to add an InclusiveNamespaces PrefixList as a CanonicalizationMethod child when generating Signatures using WSConstants.C14N_EXCL_OMIT_COMMENTS.
1 parent 531dd98 commit 65dc742

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

spring-ws-security/src/main/java/org/springframework/ws/soap/security/wss4j2/Wss4jSecurityInterceptor.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ public class Wss4jSecurityInterceptor extends AbstractWsSecurityInterceptor impl
141141

142142
private boolean bspCompliant;
143143

144+
private boolean addInclusivePrefixes;
145+
144146
private boolean securementUseDerivedKey;
145147

146148
private CallbackHandler samlCallbackHandler;
@@ -503,7 +505,16 @@ public void setBspCompliant(boolean bspCompliant) {
503505
this.handler.setOption(WSHandlerConstants.IS_BSP_COMPLIANT, bspCompliant);
504506
this.bspCompliant = bspCompliant;
505507
}
506-
508+
509+
/**
510+
* Sets whether to add an InclusiveNamespaces PrefixList as a CanonicalizationMethod child
511+
* when generating Signatures using WSConstants.C14N_EXCL_OMIT_COMMENTS. Default is {@code true}.
512+
*/
513+
public void setAddInclusivePrefixes(boolean addInclusivePrefixes) {
514+
this.handler.setOption(WSHandlerConstants.ADD_INCLUSIVE_PREFIXES, addInclusivePrefixes);
515+
this.addInclusivePrefixes = addInclusivePrefixes;
516+
}
517+
507518
/**
508519
* Sets whether the RSA 1.5 key transport algorithm is allowed.
509520
*/
@@ -643,6 +654,9 @@ protected RequestData initializeValidationRequestData(MessageContext messageCont
643654
if (requestData.getBSPEnforcer() != null) {
644655
requestData.getBSPEnforcer().setDisableBSPRules(!bspCompliant);
645656
}
657+
658+
requestData.setAddInclusivePrefixes(addInclusivePrefixes);
659+
646660
// allow for qualified password types for .Net interoperability
647661
requestData.setAllowNamespaceQualifiedPasswordTypes(true);
648662

spring-ws-security/src/test/java/org/springframework/ws/soap/security/wss4j2/Wss4jMessageInterceptorUsernameTokenTestCase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ protected Wss4jSecurityInterceptor prepareInterceptor(String actions, boolean va
147147
interceptor.setValidationCallbackHandler(callbackHandler);
148148

149149
interceptor.setBspCompliant(false);
150+
151+
interceptor.setAddInclusivePrefixes(false);
150152

151153
interceptor.afterPropertiesSet();
152154
return interceptor;

0 commit comments

Comments
 (0)