Upgraded to WSS4J 1.6.15

This commit is contained in:
Arjen Poutsma
2014-04-25 12:05:44 +02:00
parent 12a10a34f1
commit 1a5416d84c
4 changed files with 25 additions and 6 deletions

View File

@@ -223,7 +223,7 @@ project('spring-ws-security') {
optional("com.sun.xml.wss:xws-security:3.0") {
exclude group: 'javax.xml.crypto', module: 'xmldsig'
}
optional("org.apache.ws.security:wss4j:1.6.5")
optional("org.apache.ws.security:wss4j:1.6.15")
// SOAP
provided("com.sun.xml.messaging.saaj:saaj-impl:1.3.19") // required for XWSS

View File

@@ -564,6 +564,8 @@ public class Wss4jSecurityInterceptor extends AbstractWsSecurityInterceptor impl
requestData.setWssConfig(wssConfig);
messageContext.setProperty(WSHandlerConstants.TTL_TIMESTAMP, Integer.toString(securementTimeToLive));
return requestData;
}

View File

@@ -70,9 +70,18 @@ public abstract class Wss4jMessageInterceptorSpringSecurityCallbackHandlerTestCa
@Test
public void testValidateUsernameTokenDigest() throws Exception {
EndpointInterceptor interceptor = prepareInterceptor("UsernameToken", true, true);
SoapMessage message = loadSoap11Message("usernameTokenDigest-soap.xml");
Wss4jSecurityInterceptor interceptor = new Wss4jSecurityInterceptor();
interceptor.setSecurementActions("UsernameToken");
interceptor.setSecurementUsername("Bert");
interceptor.setSecurementPassword("Ernie");
interceptor.setSecurementPasswordType(WSConstants.PW_DIGEST);
SoapMessage message = loadSoap11Message("empty-soap.xml");
MessageContext messageContext = new DefaultMessageContext(message, getSoap11MessageFactory());
interceptor.handleRequest(messageContext);
interceptor = prepareInterceptor("UsernameToken", true, true);
interceptor.handleRequest(messageContext, null);
assertValidateUsernameToken(message);
@@ -91,7 +100,7 @@ public abstract class Wss4jMessageInterceptorSpringSecurityCallbackHandlerTestCa
assertNotNull("No Authentication created", SecurityContextHolder.getContext().getAuthentication());
}
protected EndpointInterceptor prepareInterceptor(String actions, boolean validating, boolean digest)
protected Wss4jSecurityInterceptor prepareInterceptor(String actions, boolean validating, boolean digest)
throws Exception {
Wss4jSecurityInterceptor interceptor = new Wss4jSecurityInterceptor();
if (validating) {

View File

@@ -49,9 +49,17 @@ public abstract class Wss4jMessageInterceptorUsernameTokenTestCase extends Wss4j
@Test
public void testValidateUsernameTokenDigest() throws Exception {
Wss4jSecurityInterceptor interceptor = prepareInterceptor("UsernameToken", true, true);
SoapMessage message = loadSoap11Message("usernameTokenDigest-soap.xml");
Wss4jSecurityInterceptor interceptor = new Wss4jSecurityInterceptor();
interceptor.setSecurementActions("UsernameToken");
interceptor.setSecurementUsername("Bert");
interceptor.setSecurementPassword("Ernie");
interceptor.setSecurementPasswordType(WSConstants.PW_DIGEST);
SoapMessage message = loadSoap11Message("empty-soap.xml");
MessageContext messageContext = new DefaultMessageContext(message, getSoap11MessageFactory());
interceptor.handleRequest(messageContext);
interceptor = prepareInterceptor("UsernameToken", true, true);
interceptor.validateMessage(message, messageContext);
assertValidateUsernameToken(message);
}