Skip to content

Commit c2fb282

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 a5c3a38 commit c2fb282

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
// Allow RSA 15 to maintain default behavior
@@ -492,7 +494,16 @@ public void setBspCompliant(boolean bspCompliant) {
492494
this.handler.setOption(WSHandlerConstants.IS_BSP_COMPLIANT, bspCompliant);
493495
this.bspCompliant = bspCompliant;
494496
}
495-
497+
498+
/**
499+
* Sets whether to add an InclusiveNamespaces PrefixList as a CanonicalizationMethod child
500+
* when generating Signatures using WSConstants.C14N_EXCL_OMIT_COMMENTS. Default is {@code true}.
501+
*/
502+
public void setAddInclusivePrefixes(boolean addInclusivePrefixes) {
503+
this.handler.setOption(WSHandlerConstants.ADD_INCLUSIVE_PREFIXES, addInclusivePrefixes);
504+
this.addInclusivePrefixes = addInclusivePrefixes;
505+
}
506+
496507
/**
497508
* Sets whether the RSA 1.5 key transport algorithm is allowed.
498509
*/
@@ -629,6 +640,9 @@ protected RequestData initializeValidationRequestData(MessageContext messageCont
629640
{
630641
requestData.getBSPEnforcer().setDisableBSPRules(!bspCompliant);
631642
}
643+
644+
requestData.setAddInclusivePrefixes(addInclusivePrefixes);
645+
632646
// allow for qualified password types for .Net interoperability
633647
requestData.setAllowNamespaceQualifiedPasswordTypes(true);
634648

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)