Skip to content

Commit

Permalink
Upgraded to WSS4J 1.6.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjen Poutsma committed Apr 25, 2014
1 parent 12a10a3 commit 1a5416d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ protected RequestData initializeRequestData(MessageContext messageContext) {

requestData.setWssConfig(wssConfig);

messageContext.setProperty(WSHandlerConstants.TTL_TIMESTAMP, Integer.toString(securementTimeToLive));

return requestData;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,18 @@ public void testValidateUsernameTokenPlainText() throws Exception {

@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);

Expand All @@ -91,7 +100,7 @@ protected void assertValidateUsernameToken(SoapMessage message) throws Exception
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,17 @@ public void testValidateUsernameTokenPlainText() throws Exception {

@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);
}
Expand Down

0 comments on commit 1a5416d

Please sign in to comment.