Author: coheigea
Date: Fri Mar 11 15:39:59 2011
New Revision: 1080611
URL: http://svn.apache.org/viewvc?rev=1080611&view=rev
Log:
Moved some security test resources around, updated crypto properties to WSS4J
1.6 tags, and did some refactoring of the WSS4JInOutTest.
Added:
cxf/trunk/rt/ws/security/src/test/resources/alice.jks
- copied unchanged from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/alice.jks
cxf/trunk/rt/ws/security/src/test/resources/alice.properties
- copied, changed from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/alice.properties
cxf/trunk/rt/ws/security/src/test/resources/client.properties
- copied, changed from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/client.properties
cxf/trunk/rt/ws/security/src/test/resources/cxfca.jks
- copied unchanged from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/cxfca.jks
cxf/trunk/rt/ws/security/src/test/resources/cxfca.properties
- copied, changed from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/cxfca.properties
cxf/trunk/rt/ws/security/src/test/resources/insecurity.properties
- copied, changed from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/insecurity.properties
cxf/trunk/rt/ws/security/src/test/resources/key.rsa
- copied unchanged from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/key.rsa
cxf/trunk/rt/ws/security/src/test/resources/logging.properties
- copied unchanged from r1080504,
cxf/trunk/rt/ws/security/src/test/java/logging.properties
cxf/trunk/rt/ws/security/src/test/resources/outsecurity.properties
- copied, changed from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/outsecurity.properties
cxf/trunk/rt/ws/security/src/test/resources/privatestore.jks
- copied unchanged from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/privatestore.jks
cxf/trunk/rt/ws/security/src/test/resources/publicstore.jks
- copied unchanged from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/publicstore.jks
cxf/trunk/rt/ws/security/src/test/resources/request.xml
- copied unchanged from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/request.xml
cxf/trunk/rt/ws/security/src/test/resources/saml1_sv.properties
cxf/trunk/rt/ws/security/src/test/resources/saml2_hok.properties
cxf/trunk/rt/ws/security/src/test/resources/saml2_sv.properties
cxf/trunk/rt/ws/security/src/test/resources/service_enc.xml
- copied unchanged from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/service_enc.xml
cxf/trunk/rt/ws/security/src/test/resources/service_sgn.xml
- copied unchanged from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/service_sgn.xml
Removed:
cxf/trunk/rt/ws/security/src/test/java/META-INF/
cxf/trunk/rt/ws/security/src/test/java/logging.properties
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/RoundTripTest.java
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/SignatureConfirmationTest.java
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/UserNameTokenAuthorizationTest.java
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java?rev=1080611&r1=1080610&r2=1080611&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
(original)
+++
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
Fri Mar 11 15:39:59 2011
@@ -55,6 +55,8 @@ public abstract class AbstractSecurityTe
addNamespace("s", Soap11.getInstance().getNamespace());
addNamespace("xenc", WSConstants.ENC_NS);
addNamespace("wsu", WSConstants.WSU_NS);
+ addNamespace("saml1", WSConstants.SAML_NS);
+ addNamespace("saml2", WSConstants.SAML2_NS);
}
/**
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java?rev=1080611&r1=1080610&r2=1080611&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
(original)
+++
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/CryptoCoverageCheckerTest.java
Fri Mar 11 15:39:59 2011
@@ -229,9 +229,9 @@ public class CryptoCoverageCheckerTest e
inHandler.setProperty(WSHandlerConstants.ACTION, action);
inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
- "META-INF/cxf/insecurity.properties");
+ "insecurity.properties");
inHandler.setProperty(WSHandlerConstants.DEC_PROP_FILE,
- "META-INF/cxf/insecurity.properties");
+ "insecurity.properties");
inHandler.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,
TestPwdCallback.class.getName());
inHandler.setProperty(WSHandlerConstants.IS_BSP_COMPLIANT, "false");
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java?rev=1080611&r1=1080610&r2=1080611&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java
(original)
+++
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java
Fri Mar 11 15:39:59 2011
@@ -853,7 +853,7 @@ public class PolicyBasedWss4JInOutTest e
new SecurityToken(assertionId, issuedAssertion, null);
Properties cryptoProps = new Properties();
- URL url =
ClassLoader.getSystemResource("META-INF/cxf/outsecurity.properties");
+ URL url = ClassLoader.getSystemResource("outsecurity.properties");
cryptoProps.load(url.openStream());
Crypto crypto = CryptoFactory.getInstance(cryptoProps);
String alias =
cryptoProps.getProperty("org.apache.ws.security.crypto.merlin.keystore.alias");
@@ -899,9 +899,9 @@ public class PolicyBasedWss4JInOutTest e
}
inHandler.setProperty(WSHandlerConstants.ACTION, action);
inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
- "META-INF/cxf/insecurity.properties");
+ "insecurity.properties");
inHandler.setProperty(WSHandlerConstants.DEC_PROP_FILE,
- "META-INF/cxf/insecurity.properties");
+ "insecurity.properties");
inHandler.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,
TestPwdCallback.class.getName());
inHandler.setProperty(WSHandlerConstants.IS_BSP_COMPLIANT, "false");
@@ -918,8 +918,8 @@ public class PolicyBasedWss4JInOutTest e
private SoapMessage getOutSoapMessageForDom(Document doc, AssertionInfoMap
aim)
throws SOAPException {
SoapMessage msg = this.getSoapMessageForDom(doc, aim);
- msg.put(SecurityConstants.SIGNATURE_PROPERTIES,
"META-INF/cxf/outsecurity.properties");
- msg.put(SecurityConstants.ENCRYPT_PROPERTIES,
"META-INF/cxf/outsecurity.properties");
+ msg.put(SecurityConstants.SIGNATURE_PROPERTIES,
"outsecurity.properties");
+ msg.put(SecurityConstants.ENCRYPT_PROPERTIES,
"outsecurity.properties");
msg.put(SecurityConstants.CALLBACK_HANDLER,
TestPwdCallback.class.getName());
msg.put(SecurityConstants.SIGNATURE_USERNAME, "myalias");
msg.put(SecurityConstants.ENCRYPT_USERNAME, "myalias");
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/RoundTripTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/RoundTripTest.java?rev=1080611&r1=1080610&r2=1080611&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/RoundTripTest.java
(original)
+++
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/RoundTripTest.java
Fri Mar 11 15:39:59 2011
@@ -55,15 +55,15 @@ public class RoundTripTest extends Abstr
service.getOutInterceptors().add(new LoggingOutInterceptor());
wsIn = new WSS4JInInterceptor();
- wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/insecurity.properties");
- wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"META-INF/cxf/insecurity.properties");
+ wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"insecurity.properties");
+ wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"insecurity.properties");
wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,
TestPwdCallback.class.getName());
service.getInInterceptors().add(wsIn);
wsOut = new WSS4JOutInterceptor();
- wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
- wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"outsecurity.properties");
+ wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE,
"outsecurity.properties");
wsOut.setProperty(WSHandlerConstants.USER, "myalias");
wsOut.setProperty("password", "myAliasPassword");
wsOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,
TestPwdCallback.class.getName());
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/SignatureConfirmationTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/SignatureConfirmationTest.java?rev=1080611&r1=1080610&r2=1080611&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/SignatureConfirmationTest.java
(original)
+++
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/SignatureConfirmationTest.java
Fri Mar 11 15:39:59 2011
@@ -79,7 +79,7 @@ public class SignatureConfirmationTest e
msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
msg.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "true");
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties");
msg.put(WSHandlerConstants.USER, "myalias");
msg.put("password", "myAliasPassword");
//
@@ -122,7 +122,7 @@ public class SignatureConfirmationTest e
inmsg.setContent(SOAPMessage.class, saajMsg);
inHandler.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
- inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/insecurity.properties");
+ inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"insecurity.properties");
inHandler.setProperty(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "true");
inHandler.handleMessage(inmsg);
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/UserNameTokenAuthorizationTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/UserNameTokenAuthorizationTest.java?rev=1080611&r1=1080610&r2=1080611&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/UserNameTokenAuthorizationTest.java
(original)
+++
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/UserNameTokenAuthorizationTest.java
Fri Mar 11 15:39:59 2011
@@ -63,8 +63,8 @@ public class UserNameTokenAuthorizationT
wsIn = new SimpleSubjectCreatingInterceptor();
wsIn.setSupportDigestPasswords(digest);
- wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/insecurity.properties");
- wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"META-INF/cxf/insecurity.properties");
+ wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"insecurity.properties");
+ wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"insecurity.properties");
wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,
TestPwdCallback.class.getName());
service.getInInterceptors().add(wsIn);
@@ -75,8 +75,8 @@ public class UserNameTokenAuthorizationT
wsOut = new WSS4JOutInterceptor();
- wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
- wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"outsecurity.properties");
+ wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE,
"outsecurity.properties");
wsOut.setProperty(WSHandlerConstants.USER, "myalias");
if (digest) {
wsOut.setProperty("password", "myAliasPassword");
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java?rev=1080611&r1=1080610&r2=1080611&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
(original)
+++
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JFaultCodeTest.java
Fri Mar 11 15:39:59 2011
@@ -95,7 +95,7 @@ public class WSS4JFaultCodeTest extends
inmsg.setContent(SOAPMessage.class, saajMsg);
inHandler.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.ENCRYPT);
- inHandler.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"META-INF/cxf/insecurity.properties");
+ inHandler.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"insecurity.properties");
inHandler.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,
TestPwdCallback.class.getName());
try {
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java?rev=1080611&r1=1080610&r2=1080611&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
(original)
+++
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
Fri Mar 11 15:39:59 2011
@@ -59,6 +59,7 @@ import org.apache.ws.security.WSDataRef;
import org.apache.ws.security.WSSecurityEngineResult;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.handler.WSHandlerResult;
+import org.apache.ws.security.util.WSSecurityUtil;
import org.junit.Test;
@@ -86,202 +87,84 @@ public class WSS4JInOutTest extends Abst
assertTrue(output.contains("MustUnderstandInterceptor,
SAAJInInterceptor, WSS4JInInterceptor"));
}
+
@Test
public void testSignature() throws Exception {
- Document doc = readDocument("wsse-request-clean.xml");
-
- WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
- PhaseInterceptor<SoapMessage> handler =
ohandler.createEndingInterceptor();
-
- SoapMessage msg = new SoapMessage(new MessageImpl());
- Exchange ex = new ExchangeImpl();
- ex.setInMessage(msg);
-
- SOAPMessage saajMsg = MessageFactory.newInstance().createMessage();
- SOAPPart part = saajMsg.getSOAPPart();
- part.setContent(new DOMSource(doc));
- saajMsg.saveChanges();
-
- msg.setContent(SOAPMessage.class, saajMsg);
-
- msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
- msg.put(WSHandlerConstants.USER, "myalias");
- msg.put("password", "myAliasPassword");
-
- handler.handleMessage(msg);
-
- doc = part;
-
- assertValid("//wsse:Security", doc);
- assertValid("//wsse:Security/ds:Signature", doc);
-
- byte[] docbytes = getMessageBytes(doc);
- XMLStreamReader reader = StaxUtils.createXMLStreamReader(new
ByteArrayInputStream(docbytes));
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-
- dbf.setValidating(false);
- dbf.setIgnoringComments(false);
- dbf.setIgnoringElementContentWhitespace(true);
- dbf.setNamespaceAware(true);
-
- DocumentBuilder db = dbf.newDocumentBuilder();
- db.setEntityResolver(new NullResolver());
- doc = StaxUtils.read(db, reader, false);
-
- WSS4JInInterceptor inHandler = new WSS4JInInterceptor();
-
- SoapMessage inmsg = new SoapMessage(new MessageImpl());
- ex.setInMessage(inmsg);
- inmsg.setContent(SOAPMessage.class, saajMsg);
-
- inHandler.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
- inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/insecurity.properties");
-
- inHandler.handleMessage(inmsg);
-
- WSSecurityEngineResult result =
- (WSSecurityEngineResult)
inmsg.get(WSS4JInInterceptor.SIGNATURE_RESULT);
- assertNotNull(result);
- X509Certificate certificate = (X509Certificate)result
- .get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
+ Map<String, String> outProperties = new HashMap<String, String>();
+ outProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
+ outProperties.put(WSHandlerConstants.SIG_PROP_FILE,
"outsecurity.properties");
+ outProperties.put(WSHandlerConstants.USER, "myalias");
+ outProperties.put("password", "myAliasPassword");
+
+ Map<String, String> inProperties = new HashMap<String, String>();
+ inProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
+ inProperties.put(WSHandlerConstants.SIG_PROP_FILE,
"insecurity.properties");
+
+ List<String> xpaths = new ArrayList<String>();
+ xpaths.add("//wsse:Security");
+ xpaths.add("//wsse:Security/ds:Signature");
+
+ List<WSHandlerResult> handlerResults =
+ makeInvocation(outProperties, xpaths, inProperties);
+ WSSecurityEngineResult actionResult =
+
WSSecurityUtil.fetchActionResult(handlerResults.get(0).getResults(),
WSConstants.SIGN);
+
+ X509Certificate certificate =
+ (X509Certificate)
actionResult.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
assertNotNull(certificate);
}
@Test
public void testDirectReferenceSignature() throws Exception {
- Document doc = readDocument("wsse-request-clean.xml");
-
- WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
- PhaseInterceptor<SoapMessage> handler =
ohandler.createEndingInterceptor();
-
- SoapMessage msg = new SoapMessage(new MessageImpl());
- Exchange ex = new ExchangeImpl();
- ex.setInMessage(msg);
-
- SOAPMessage saajMsg = MessageFactory.newInstance().createMessage();
- SOAPPart part = saajMsg.getSOAPPart();
- part.setContent(new DOMSource(doc));
- saajMsg.saveChanges();
-
- msg.setContent(SOAPMessage.class, saajMsg);
-
- msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
- msg.put(WSHandlerConstants.USER, "myalias");
- msg.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
- msg.put("password", "myAliasPassword");
-
- handler.handleMessage(msg);
-
- doc = part;
-
- assertValid("//wsse:Security", doc);
- // Check to see that the binary security token was inserted in the
header
- assertValid("//wsse:Security/wsse:BinarySecurityToken", doc);
- assertValid("//wsse:Security/ds:Signature", doc);
-
- byte[] docbytes = getMessageBytes(doc);
- XMLStreamReader reader = StaxUtils.createXMLStreamReader(new
ByteArrayInputStream(docbytes));
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-
- dbf.setValidating(false);
- dbf.setIgnoringComments(false);
- dbf.setIgnoringElementContentWhitespace(true);
- dbf.setNamespaceAware(true);
-
- DocumentBuilder db = dbf.newDocumentBuilder();
- db.setEntityResolver(new NullResolver());
- doc = StaxUtils.read(db, reader, false);
-
- WSS4JInInterceptor inHandler = new WSS4JInInterceptor();
-
- SoapMessage inmsg = new SoapMessage(new MessageImpl());
- ex.setInMessage(inmsg);
- inmsg.setContent(SOAPMessage.class, saajMsg);
-
- inHandler.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
- inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/insecurity.properties");
-
- inHandler.handleMessage(inmsg);
-
- WSSecurityEngineResult result =
- (WSSecurityEngineResult)
inmsg.get(WSS4JInInterceptor.SIGNATURE_RESULT);
- assertNotNull(result);
- X509Certificate certificate = (X509Certificate)result
- .get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
+ Map<String, String> outProperties = new HashMap<String, String>();
+ outProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
+ outProperties.put(WSHandlerConstants.SIG_PROP_FILE,
"outsecurity.properties");
+ outProperties.put(WSHandlerConstants.USER, "myalias");
+ outProperties.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
+ outProperties.put("password", "myAliasPassword");
+
+ Map<String, String> inProperties = new HashMap<String, String>();
+ inProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
+ inProperties.put(WSHandlerConstants.SIG_PROP_FILE,
"insecurity.properties");
+
+ List<String> xpaths = new ArrayList<String>();
+ xpaths.add("//wsse:Security");
+ xpaths.add("//wsse:Security/wsse:BinarySecurityToken");
+ xpaths.add("//wsse:Security/ds:Signature");
+
+ List<WSHandlerResult> handlerResults =
+ makeInvocation(outProperties, xpaths, inProperties);
+ WSSecurityEngineResult actionResult =
+
WSSecurityUtil.fetchActionResult(handlerResults.get(0).getResults(),
WSConstants.SIGN);
+
+ X509Certificate certificate =
+ (X509Certificate)
actionResult.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
assertNotNull(certificate);
}
@Test
public void testEncryption() throws Exception {
- Document doc = readDocument("wsse-request-clean.xml");
-
- WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
- PhaseInterceptor<SoapMessage> handler =
ohandler.createEndingInterceptor();
-
- SoapMessage msg = new SoapMessage(new MessageImpl());
- Exchange ex = new ExchangeImpl();
- ex.setInMessage(msg);
-
- SOAPMessage saajMsg = MessageFactory.newInstance().createMessage();
- SOAPPart part = saajMsg.getSOAPPart();
- part.setContent(new DOMSource(doc));
- saajMsg.saveChanges();
-
- msg.setContent(SOAPMessage.class, saajMsg);
-
- msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.ENCRYPT);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
- msg.put(WSHandlerConstants.ENC_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
- msg.put(WSHandlerConstants.USER, "myalias");
- msg.put("password", "myAliasPassword");
-
- handler.handleMessage(msg);
- doc = part;
-
- assertValid("//wsse:Security", doc);
- assertValid("//s:Body/xenc:EncryptedData", doc);
-
- byte[] docbytes = getMessageBytes(doc);
- XMLStreamReader reader = StaxUtils.createXMLStreamReader(new
ByteArrayInputStream(docbytes));
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-
- dbf.setValidating(false);
- dbf.setIgnoringComments(false);
- dbf.setIgnoringElementContentWhitespace(true);
- dbf.setNamespaceAware(true);
-
- DocumentBuilder db = dbf.newDocumentBuilder();
- db.setEntityResolver(new NullResolver());
- doc = StaxUtils.read(db, reader, false);
-
- WSS4JInInterceptor inHandler = new WSS4JInInterceptor();
-
- SoapMessage inmsg = new SoapMessage(new MessageImpl());
- ex.setInMessage(inmsg);
- inmsg.setContent(SOAPMessage.class, saajMsg);
-
- inHandler.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.ENCRYPT);
- inHandler.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"META-INF/cxf/insecurity.properties");
- inHandler.setProperty(
+ Map<String, String> outProperties = new HashMap<String, String>();
+ outProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.ENCRYPT);
+ outProperties.put(WSHandlerConstants.ENC_PROP_FILE,
"outsecurity.properties");
+ outProperties.put(WSHandlerConstants.USER, "myalias");
+ outProperties.put("password", "myAliasPassword");
+
+ Map<String, String> inProperties = new HashMap<String, String>();
+ inProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.ENCRYPT);
+ inProperties.put(WSHandlerConstants.DEC_PROP_FILE,
"insecurity.properties");
+ inProperties.put(
WSHandlerConstants.PW_CALLBACK_CLASS,
"org.apache.cxf.ws.security.wss4j.TestPwdCallback"
);
+
+ List<String> xpaths = new ArrayList<String>();
+ xpaths.add("//wsse:Security");
+ xpaths.add("//s:Body/xenc:EncryptedData");
+
+ List<WSHandlerResult> handlerResults =
+ makeInvocation(outProperties, xpaths, inProperties);
- inHandler.handleMessage(inmsg);
- //
- // Check that the EncryptedData is no longer there
- //
- assertInvalid("//s:Body/xenc:EncryptedData", saajMsg.getSOAPPart());
- //
- // There should be exactly 1 (WSS4J) HandlerResult
- //
- final java.util.List<WSHandlerResult> handlerResults =
-
CastUtils.cast((List<?>)inmsg.get(WSHandlerConstants.RECV_RESULTS));
assertNotNull(handlerResults);
assertSame(handlerResults.size(), 1);
//
@@ -312,80 +195,37 @@ public class WSS4JInOutTest extends Abst
@Test
public void testEncryptedUsernameToken() throws Exception {
- Document doc = readDocument("wsse-request-clean.xml");
-
- WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
- PhaseInterceptor<SoapMessage> handler =
ohandler.createEndingInterceptor();
-
- SoapMessage msg = new SoapMessage(new MessageImpl());
- Exchange ex = new ExchangeImpl();
- ex.setInMessage(msg);
-
- SOAPMessage saajMsg = MessageFactory.newInstance().createMessage();
- SOAPPart part = saajMsg.getSOAPPart();
- part.setContent(new DOMSource(doc));
- saajMsg.saveChanges();
-
- msg.setContent(SOAPMessage.class, saajMsg);
-
- msg.put(
- WSHandlerConstants.ACTION,
+ Map<String, String> outProperties = new HashMap<String, String>();
+ outProperties.put(
+ WSHandlerConstants.ACTION,
WSHandlerConstants.USERNAME_TOKEN + " " +
WSHandlerConstants.ENCRYPT
);
- msg.put(WSHandlerConstants.ENC_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
- msg.put(WSHandlerConstants.USER, "alice");
- msg.put("password", "alicePassword");
- msg.put(WSHandlerConstants.ENCRYPTION_USER, "myalias");
- msg.put(
+ outProperties.put(WSHandlerConstants.ENC_PROP_FILE,
"outsecurity.properties");
+ outProperties.put(WSHandlerConstants.USER, "alice");
+ outProperties.put("password", "alicePassword");
+ outProperties.put(WSHandlerConstants.ENCRYPTION_USER, "myalias");
+ outProperties.put(
WSHandlerConstants.ENCRYPTION_PARTS,
"{Content}{" + WSConstants.WSSE_NS + "}UsernameToken"
);
-
- handler.handleMessage(msg);
- doc = part;
-
- assertValid("//wsse:Security", doc);
-
- byte[] docbytes = getMessageBytes(doc);
- XMLStreamReader reader = StaxUtils.createXMLStreamReader(new
ByteArrayInputStream(docbytes));
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-
- dbf.setValidating(false);
- dbf.setIgnoringComments(false);
- dbf.setIgnoringElementContentWhitespace(true);
- dbf.setNamespaceAware(true);
-
- DocumentBuilder db = dbf.newDocumentBuilder();
- db.setEntityResolver(new NullResolver());
- doc = StaxUtils.read(db, reader, false);
-
- WSS4JInInterceptor inHandler = new WSS4JInInterceptor();
-
- SoapMessage inmsg = new SoapMessage(new MessageImpl());
- ex.setInMessage(inmsg);
- inmsg.setContent(SOAPMessage.class, saajMsg);
-
- inHandler.setProperty(
+
+ Map<String, String> inProperties = new HashMap<String, String>();
+ inProperties.put(
WSHandlerConstants.ACTION,
WSHandlerConstants.USERNAME_TOKEN + " " +
WSHandlerConstants.ENCRYPT
);
- inHandler.setProperty(WSHandlerConstants.DEC_PROP_FILE,
"META-INF/cxf/insecurity.properties");
- inHandler.setProperty(
+ inProperties.put(WSHandlerConstants.DEC_PROP_FILE,
"insecurity.properties");
+ inProperties.put(
WSHandlerConstants.PW_CALLBACK_CLASS,
"org.apache.cxf.ws.security.wss4j.TestPwdCallback"
);
+
+ List<String> xpaths = new ArrayList<String>();
+ xpaths.add("//wsse:Security");
+
+ List<WSHandlerResult> handlerResults =
+ makeInvocation(outProperties, xpaths, inProperties);
- inHandler.handleMessage(inmsg);
- //
- // Check that the EncryptedData is no longer there
- //
- assertInvalid("//s:Body/xenc:EncryptedData", saajMsg.getSOAPPart());
- //
- // There should be exactly 1 (WSS4J) HandlerResult
- //
- final java.util.List<WSHandlerResult> handlerResults =
-
CastUtils.cast((List<?>)inmsg.get(WSHandlerConstants.RECV_RESULTS));
assertNotNull(handlerResults);
assertSame(handlerResults.size(), 1);
@@ -400,87 +240,38 @@ public class WSS4JInOutTest extends Abst
@Test
public void testUsernameToken() throws Exception {
- Document doc = readDocument("wsse-request-clean.xml");
-
- WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
- PhaseInterceptor<SoapMessage> handler =
ohandler.createEndingInterceptor();
-
- SoapMessage msg = new SoapMessage(new MessageImpl());
- Exchange ex = new ExchangeImpl();
- ex.setInMessage(msg);
-
- SOAPMessage saajMsg = MessageFactory.newInstance().createMessage();
- SOAPPart part = saajMsg.getSOAPPart();
- part.setContent(new DOMSource(doc));
- saajMsg.saveChanges();
-
- msg.setContent(SOAPMessage.class, saajMsg);
-
- msg.put(
- WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN
+ Map<String, String> outProperties = new HashMap<String, String>();
+ outProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.USERNAME_TOKEN);
+ outProperties.put(WSHandlerConstants.PASSWORD_TYPE,
WSConstants.PW_TEXT);
+ outProperties.put(WSHandlerConstants.USER, "alice");
+ outProperties.put("password", "alicePassword");
+
+ Map<String, String> inProperties = new HashMap<String, String>();
+ inProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.USERNAME_TOKEN);
+ inProperties.put(WSHandlerConstants.PASSWORD_TYPE,
WSConstants.PW_DIGEST);
+ inProperties.put(WSHandlerConstants.PASSWORD_TYPE_STRICT, "false");
+ inProperties.put(
+ WSHandlerConstants.PW_CALLBACK_CLASS,
+ "org.apache.cxf.ws.security.wss4j.TestPwdCallback"
);
- msg.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
- msg.put(WSHandlerConstants.USER, "alice");
- msg.put("password", "alicePassword");
-
- handler.handleMessage(msg);
- doc = part;
-
- assertValid("//wsse:Security", doc);
-
- byte[] docbytes = getMessageBytes(doc);
- XMLStreamReader reader = StaxUtils.createXMLStreamReader(new
ByteArrayInputStream(docbytes));
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-
- dbf.setValidating(false);
- dbf.setIgnoringComments(false);
- dbf.setIgnoringElementContentWhitespace(true);
- dbf.setNamespaceAware(true);
-
- DocumentBuilder db = dbf.newDocumentBuilder();
- db.setEntityResolver(new NullResolver());
- doc = StaxUtils.read(db, reader, false);
-
- SoapMessage inmsg = new SoapMessage(new MessageImpl());
- ex.setInMessage(inmsg);
- inmsg.setContent(SOAPMessage.class, saajMsg);
+
+ List<String> xpaths = new ArrayList<String>();
+ xpaths.add("//wsse:Security");
//
// This should pass, as even though passwordType is set to digest, we
are
// overriding the default handler behaviour of requiring a strict
password
// type
- WSS4JInInterceptor inHandler = new WSS4JInInterceptor();
- inHandler.setProperty(
- WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN
- );
- inHandler.setProperty(WSHandlerConstants.PASSWORD_TYPE,
WSConstants.PW_DIGEST);
- inHandler.setProperty(WSHandlerConstants.PASSWORD_TYPE_STRICT,
"false");
- inHandler.setProperty(
- WSHandlerConstants.PW_CALLBACK_CLASS,
- "org.apache.cxf.ws.security.wss4j.TestPwdCallback"
- );
- inHandler.handleMessage(inmsg);
-
- inmsg = new SoapMessage(new MessageImpl());
- ex.setInMessage(inmsg);
- inmsg.setContent(SOAPMessage.class, saajMsg);
+ //
+ makeInvocation(outProperties, xpaths, inProperties);
//
// This should fail, as we are requiring a digest password type
//
- inHandler = new WSS4JInInterceptor();
- inHandler.setProperty(
- WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN
- );
- inHandler.setProperty(
- WSHandlerConstants.PW_CALLBACK_CLASS,
- "org.apache.cxf.ws.security.wss4j.TestPwdCallback"
- );
- inHandler.setProperty(WSHandlerConstants.PASSWORD_TYPE,
WSConstants.PW_DIGEST);
+ inProperties.put(WSHandlerConstants.PASSWORD_TYPE_STRICT, "true");
try {
- inHandler.handleMessage(inmsg);
- fail("Expected failure on password digest");
+ makeInvocation(outProperties, xpaths, inProperties);
+ fail("Failure expected on the wrong password type");
} catch (org.apache.cxf.interceptor.Fault fault) {
// expected
}
@@ -505,7 +296,7 @@ public class WSS4JInOutTest extends Abst
msg.setContent(SOAPMessage.class, saajMsg);
msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties");
msg.put(WSHandlerConstants.USER, "myalias");
msg.put("password", "myAliasPassword");
@@ -569,7 +360,7 @@ public class WSS4JInOutTest extends Abst
msg.setContent(SOAPMessage.class, saajMsg);
msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties");
msg.put(WSHandlerConstants.USER, "myalias");
msg.put("password", "myAliasPassword");
@@ -628,6 +419,68 @@ public class WSS4JInOutTest extends Abst
@Test
public void testPKIPath() throws Exception {
+ Map<String, String> outProperties = new HashMap<String, String>();
+ outProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
+ outProperties.put(WSHandlerConstants.USER, "alice");
+ outProperties.put(WSHandlerConstants.SIG_PROP_FILE,
"alice.properties");
+ outProperties.put(
+ WSHandlerConstants.PW_CALLBACK_CLASS,
KeystorePasswordCallback.class.getName()
+ );
+ outProperties.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
+ outProperties.put(WSHandlerConstants.USE_SINGLE_CERTIFICATE, "false");
+
+ Map<String, String> inProperties = new HashMap<String, String>();
+ inProperties.put(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
+ inProperties.put(WSHandlerConstants.SIG_PROP_FILE, "cxfca.properties");
+
+ List<String> xpaths = new ArrayList<String>();
+ xpaths.add("//wsse:Security");
+ xpaths.add("//wsse:Security/ds:Signature");
+
+ List<WSHandlerResult> handlerResults =
+ makeInvocation(outProperties, xpaths, inProperties);
+ WSSecurityEngineResult actionResult =
+
WSSecurityUtil.fetchActionResult(handlerResults.get(0).getResults(),
WSConstants.SIGN);
+
+ X509Certificate[] certificates =
+ (X509Certificate[])
actionResult.get(WSSecurityEngineResult.TAG_X509_CERTIFICATES);
+ assertNotNull(certificates);
+ assertEquals(certificates.length, 2);
+ }
+
+
+ private byte[] getMessageBytes(Document doc) throws Exception {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ XMLStreamWriter byteArrayWriter =
StaxUtils.createXMLStreamWriter(outputStream);
+ StaxUtils.writeDocument(doc, byteArrayWriter, false);
+ byteArrayWriter.flush();
+ return outputStream.toByteArray();
+ }
+
+ /**
+ * @return a processor map suitable for custom processing of
+ * signatures (in this case, the actual processor is
+ * null, which will cause the WSS4J runtime to do no
+ * processing on the input)
+ */
+ private Map<QName, String>
+ createCustomProcessorMap() {
+ final Map<QName, String> ret = new HashMap<QName, String>();
+ ret.put(
+ new QName(
+ WSConstants.SIG_NS,
+ WSConstants.SIG_LN
+ ),
+ null
+ );
+ return ret;
+ }
+
+ private List<WSHandlerResult> makeInvocation(
+ Map<String, String> outProperties,
+ List<String> xpaths,
+ Map<String, String> inProperties
+ ) throws Exception {
Document doc = readDocument("wsse-request-clean.xml");
WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
@@ -636,7 +489,7 @@ public class WSS4JInOutTest extends Abst
SoapMessage msg = new SoapMessage(new MessageImpl());
Exchange ex = new ExchangeImpl();
ex.setInMessage(msg);
-
+
SOAPMessage saajMsg = MessageFactory.newInstance().createMessage();
SOAPPart part = saajMsg.getSOAPPart();
part.setContent(new DOMSource(doc));
@@ -644,22 +497,19 @@ public class WSS4JInOutTest extends Abst
msg.setContent(SOAPMessage.class, saajMsg);
- msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/alice.properties");
- msg.put(WSHandlerConstants.USER, "alice");
- msg.put(WSHandlerConstants.PW_CALLBACK_CLASS,
KeystorePasswordCallback.class.getName());
- msg.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
- msg.put(WSHandlerConstants.USE_SINGLE_CERTIFICATE, "false");
+ for (String key : outProperties.keySet()) {
+ msg.put(key, outProperties.get(key));
+ }
handler.handleMessage(msg);
doc = part;
-
- assertValid("//wsse:Security", doc);
- assertValid("//wsse:Security/ds:Signature", doc);
- byte[] docbytes = getMessageBytes(doc);
+ for (String xpath : xpaths) {
+ assertValid(xpath, doc);
+ }
+ byte[] docbytes = getMessageBytes(doc);
XMLStreamReader reader = StaxUtils.createXMLStreamReader(new
ByteArrayInputStream(docbytes));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -679,49 +529,17 @@ public class WSS4JInOutTest extends Abst
ex.setInMessage(inmsg);
inmsg.setContent(SOAPMessage.class, saajMsg);
- inHandler.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
- inHandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/cxfca.properties");
+ for (String key : inProperties.keySet()) {
+ inHandler.setProperty(key, inProperties.get(key));
+ }
inHandler.handleMessage(inmsg);
-
- WSSecurityEngineResult result =
- (WSSecurityEngineResult)
inmsg.get(WSS4JInInterceptor.SIGNATURE_RESULT);
- assertNotNull(result);
- X509Certificate[] certificates = (X509Certificate[])result
- .get(WSSecurityEngineResult.TAG_X509_CERTIFICATES);
- assertNotNull(certificates);
- assertEquals(certificates.length, 2);
- }
-
-
- private byte[] getMessageBytes(Document doc) throws Exception {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- XMLStreamWriter byteArrayWriter =
StaxUtils.createXMLStreamWriter(outputStream);
- StaxUtils.writeDocument(doc, byteArrayWriter, false);
- byteArrayWriter.flush();
- return outputStream.toByteArray();
- }
- /**
- * @return a processor map suitable for custom processing of
- * signatures (in this case, the actual processor is
- * null, which will cause the WSS4J runtime to do no
- * processing on the input)
- */
- private Map<QName, String>
- createCustomProcessorMap() {
- final Map<QName, String> ret = new HashMap<QName, String>();
- ret.put(
- new QName(
- WSConstants.SIG_NS,
- WSConstants.SIG_LN
- ),
- null
- );
- return ret;
+ final List<WSHandlerResult> handlerResults =
+
CastUtils.cast((List<?>)inmsg.get(WSHandlerConstants.RECV_RESULTS));
+ return handlerResults;
}
-
// FOR DEBUGGING ONLY
/*private*/ static String serialize(Document doc) {
return XMLUtils.toString(doc);
Modified:
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java?rev=1080611&r1=1080610&r2=1080611&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java
(original)
+++
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java
Fri Mar 11 15:39:59 2011
@@ -60,7 +60,7 @@ public class WSS4JOutInterceptorTest ext
msg.setContent(SOAPMessage.class, saaj);
msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties");
msg.put(WSHandlerConstants.USER, "username");
msg.put("password", "myAliasPassword");
msg.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
@@ -88,7 +88,7 @@ public class WSS4JOutInterceptorTest ext
msg.setContent(SOAPMessage.class, saaj);
msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties");
msg.put(WSHandlerConstants.USER, "username");
msg.put("password", "myAliasPassword");
msg.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
@@ -116,8 +116,8 @@ public class WSS4JOutInterceptorTest ext
msg.setContent(SOAPMessage.class, saaj);
msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.ENCRYPT);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
- msg.put(WSHandlerConstants.ENC_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties");
+ msg.put(WSHandlerConstants.ENC_PROP_FILE, "outsecurity.properties");
msg.put(WSHandlerConstants.USER, "myalias");
msg.put("password", "myAliasPassword");
@@ -142,7 +142,7 @@ public class WSS4JOutInterceptorTest ext
msg.setContent(SOAPMessage.class, saaj);
msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties");
msg.put(WSHandlerConstants.USER, "myAlias");
msg.put("password", "myAliasPassword");
@@ -167,7 +167,7 @@ public class WSS4JOutInterceptorTest ext
msg.setContent(SOAPMessage.class, saaj);
ohandler.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.TIMESTAMP);
- ohandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ ohandler.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"outsecurity.properties");
msg.put(WSHandlerConstants.USER, "myalias");
msg.put("password", "myAliasPassword");
@@ -196,7 +196,7 @@ public class WSS4JOutInterceptorTest ext
customActions.put(WSConstants.UT, action);
msg.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
- msg.put(WSHandlerConstants.SIG_PROP_FILE,
"META-INF/cxf/outsecurity.properties");
+ msg.put(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties");
msg.put(WSHandlerConstants.USER, "username");
msg.put("password", "myAliasPassword");
msg.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
Copied: cxf/trunk/rt/ws/security/src/test/resources/alice.properties (from
r1080504, cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/alice.properties)
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/resources/alice.properties?p2=cxf/trunk/rt/ws/security/src/test/resources/alice.properties&p1=cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/alice.properties&r1=1080504&r2=1080611&rev=1080611&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/alice.properties
(original)
+++ cxf/trunk/rt/ws/security/src/test/resources/alice.properties Fri Mar 11
15:39:59 2011
@@ -18,4 +18,4 @@ org.apache.ws.security.crypto.provider=o
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=password
org.apache.ws.security.crypto.merlin.keystore.alias=alice
-org.apache.ws.security.crypto.merlin.file=META-INF/cxf/alice.jks
\ No newline at end of file
+org.apache.ws.security.crypto.merlin.keystore.file=alice.jks
\ No newline at end of file
Copied: cxf/trunk/rt/ws/security/src/test/resources/client.properties (from
r1080504, cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/client.properties)
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/resources/client.properties?p2=cxf/trunk/rt/ws/security/src/test/resources/client.properties&p1=cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/client.properties&r1=1080504&r2=1080611&rev=1080611&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/client.properties
(original)
+++ cxf/trunk/rt/ws/security/src/test/resources/client.properties Fri Mar 11
15:39:59 2011
@@ -22,4 +22,4 @@ org.apache.ws.security.crypto.provider=o
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=keystorePass
org.apache.ws.security.crypto.merlin.keystore.alias=alias
-org.apache.ws.security.crypto.merlin.file=META-INF/cxf/privatestore.jks
+org.apache.ws.security.crypto.merlin.keystore.file=privatestore.jks
Copied: cxf/trunk/rt/ws/security/src/test/resources/cxfca.properties (from
r1080504, cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/cxfca.properties)
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/resources/cxfca.properties?p2=cxf/trunk/rt/ws/security/src/test/resources/cxfca.properties&p1=cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/cxfca.properties&r1=1080504&r2=1080611&rev=1080611&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/cxfca.properties
(original)
+++ cxf/trunk/rt/ws/security/src/test/resources/cxfca.properties Fri Mar 11
15:39:59 2011
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
-org.apache.ws.security.crypto.merlin.keystore.type=jks
-org.apache.ws.security.crypto.merlin.keystore.password=password
-org.apache.ws.security.crypto.merlin.keystore.alias=cxfca
-org.apache.ws.security.crypto.merlin.file=META-INF/cxf/cxfca.jks
+org.apache.ws.security.crypto.merlin.truststore.type=jks
+org.apache.ws.security.crypto.merlin.truststore.password=password
+org.apache.ws.security.crypto.merlin.truststore.alias=cxfca
+org.apache.ws.security.crypto.merlin.truststore.file=cxfca.jks
Copied: cxf/trunk/rt/ws/security/src/test/resources/insecurity.properties (from
r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/insecurity.properties)
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/resources/insecurity.properties?p2=cxf/trunk/rt/ws/security/src/test/resources/insecurity.properties&p1=cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/insecurity.properties&r1=1080504&r2=1080611&rev=1080611&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/insecurity.properties
(original)
+++ cxf/trunk/rt/ws/security/src/test/resources/insecurity.properties Fri Mar
11 15:39:59 2011
@@ -22,4 +22,4 @@ org.apache.ws.security.crypto.provider=o
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=keyStorePassword
org.apache.ws.security.crypto.merlin.keystore.alias=myalias
-org.apache.ws.security.crypto.merlin.file=META-INF/cxf/privatestore.jks
+org.apache.ws.security.crypto.merlin.keystore.file=privatestore.jks
Copied: cxf/trunk/rt/ws/security/src/test/resources/outsecurity.properties
(from r1080504,
cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/outsecurity.properties)
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/resources/outsecurity.properties?p2=cxf/trunk/rt/ws/security/src/test/resources/outsecurity.properties&p1=cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/outsecurity.properties&r1=1080504&r2=1080611&rev=1080611&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/java/META-INF/cxf/outsecurity.properties
(original)
+++ cxf/trunk/rt/ws/security/src/test/resources/outsecurity.properties Fri Mar
11 15:39:59 2011
@@ -22,4 +22,4 @@ org.apache.ws.security.crypto.provider=o
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=keyStorePassword
org.apache.ws.security.crypto.merlin.keystore.alias=myalias
-org.apache.ws.security.crypto.merlin.file=META-INF/cxf/privatestore.jks
+org.apache.ws.security.crypto.merlin.keystore.file=privatestore.jks
Added: cxf/trunk/rt/ws/security/src/test/resources/saml1_sv.properties
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/resources/saml1_sv.properties?rev=1080611&view=auto
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/resources/saml1_sv.properties (added)
+++ cxf/trunk/rt/ws/security/src/test/resources/saml1_sv.properties Fri Mar 11
15:39:59 2011
@@ -0,0 +1,7 @@
+org.apache.ws.security.saml.issuerClass=org.apache.ws.security.saml.SAMLIssuerImpl
+org.apache.ws.security.saml.issuer=www.example.com
+org.apache.ws.security.saml.issuer.cryptoProp.file=outsecurity.properties
+org.apache.ws.security.saml.issuer.key.name=myalias
+org.apache.ws.security.saml.issuer.key.password=myAliasPassword
+org.apache.ws.security.saml.version=1.1
+org.apache.ws.security.saml.callback=org.apache.cxf.ws.security.wss4j.SAML1CallbackHandler
Added: cxf/trunk/rt/ws/security/src/test/resources/saml2_hok.properties
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/resources/saml2_hok.properties?rev=1080611&view=auto
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/resources/saml2_hok.properties (added)
+++ cxf/trunk/rt/ws/security/src/test/resources/saml2_hok.properties Fri Mar 11
15:39:59 2011
@@ -0,0 +1,10 @@
+org.apache.ws.security.saml.issuerClass=org.apache.ws.security.saml.SAMLIssuerImpl
+org.apache.ws.security.saml.issuer.cryptoProp.file=crypto.properties
+org.apache.ws.security.saml.issuer.key.name=16c73ab6-b892-458f-abf5-2f875f74882e
+org.apache.ws.security.saml.issuer.key.password=security
+org.apache.ws.security.saml.issuer=www.example.com
+org.apache.ws.security.saml.issuer.sendKeyValue=false
+org.apache.ws.security.saml.issuer.signAssertion=true
+org.apache.ws.security.saml.version=1.1
+org.apache.ws.security.saml.callback=org.apache.ws.security.common.SAML1AuthnHOKHandler
+
Added: cxf/trunk/rt/ws/security/src/test/resources/saml2_sv.properties
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/test/resources/saml2_sv.properties?rev=1080611&view=auto
==============================================================================
--- cxf/trunk/rt/ws/security/src/test/resources/saml2_sv.properties (added)
+++ cxf/trunk/rt/ws/security/src/test/resources/saml2_sv.properties Fri Mar 11
15:39:59 2011
@@ -0,0 +1,7 @@
+org.apache.ws.security.saml.issuerClass=org.apache.ws.security.saml.SAMLIssuerImpl
+org.apache.ws.security.saml.issuer=www.example.com
+org.apache.ws.security.saml.issuer.cryptoProp.file=outsecurity.properties
+org.apache.ws.security.saml.issuer.key.name=myalias
+org.apache.ws.security.saml.issuer.key.password=myAliasPassword
+org.apache.ws.security.saml.version=2.0
+org.apache.ws.security.saml.callback=org.apache.cxf.ws.security.wss4j.SAML2CallbackHandler