You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2006/07/21 21:57:15 UTC
svn commit: r424439 - in /webservices/axis2/trunk/java/modules:
integration/test/org/apache/axis2/security/
security/interop/org/apache/axis2/security/
security/src/org/apache/rampart/handler/config/
Author: ruchithf
Date: Fri Jul 21 12:57:13 2006
New Revision: 424439
URL: http://svn.apache.org/viewvc?rev=424439&view=rev
Log:
IMPORTANT : Requires the latest WSS4J snapshot !
Updating all WS-Security test cases to latest WSS4J changes: Added an additional test to all test cases to test specifying the crypto impl using java.util.Properties objects
Modified:
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java
webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java
webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/InflowConfiguration.java
webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/OutflowConfiguration.java
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java Fri Jul 21 12:57:13 2006
@@ -20,6 +20,9 @@
import org.apache.rampart.handler.config.InflowConfiguration;
import org.apache.rampart.handler.config.OutflowConfiguration;
+import java.util.Hashtable;
+import java.util.Properties;
+
public class AddressingMTOMSecurityTest extends InteropTestBase {
@@ -64,6 +67,57 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
+ }
+
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+
+ OutflowConfiguration ofc = new OutflowConfiguration();
+
+ ofc.setActionItems("Timestamp Signature Encrypt");
+ ofc.setUser("alice");
+ ofc.setEncryptionUser("bob");
+ ofc.setSignaturePropRefId("key1");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setSignatureKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+ ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+ ofc.setSignatureParts("{Element}{" + ADDR_NS + "}To;" +
+ "{Element}{" + ADDR_NS + "}ReplyTo;" +
+ "{Element}{" + ADDR_NS + "}MessageID;" +
+ "{Element}{" + WSU_NS + "}Timestamp");
+ ofc.setOptimizeParts(
+ "//xenc:EncryptedData/xenc:CipherData/xenc:CipherValue");
+
+ return ofc;
+ }
+
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ InflowConfiguration ifc = new InflowConfiguration();
+
+ ifc.setActionItems("Timestamp Signature Encrypt");
+ ifc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ifc.setSignaturePropRefId("key2");
+
+ return ifc;
+ }
+
+ protected Hashtable getPropertyRefs() {
+ Properties prop1 = new Properties();
+ prop1.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Properties prop2 = new Properties();
+ prop2.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Hashtable table = new Hashtable();
+ table.put("key1", prop1);
+ table.put("key2", prop2);
+
+ return table;
}
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java Fri Jul 21 12:57:13 2006
@@ -25,6 +25,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.util.Hashtable;
import junit.framework.TestCase;
@@ -199,11 +200,45 @@
}
-
+ public void testInteropWithDynamicConfigWithProfRefs() {
+ if(getPropertyRefs() != null) {
+ try {
+
+ Class interopScenarioClientClass = Class
+ .forName("org.apache.axis2.security.InteropScenarioClient");
+ Constructor c = interopScenarioClientClass
+ .getConstructor(new Class[]{boolean.class});
+ Object clientObj = c.newInstance(new Object[]{this
+ .isUseSOAP12InStaticConfigTest() ? Boolean.TRUE
+ : Boolean.FALSE});
+ Method m = interopScenarioClientClass.getMethod(
+ "invokeWithGivenConfigWithProRefs", new Class[]{
+ String.class,
+ String.class, OutflowConfiguration.class,
+ InflowConfiguration.class, Hashtable.class});
+ m.invoke(clientObj, new Object[]{
+ Constants.TESTING_PATH + DEFAULT_CLIENT_REPOSITORY,
+ targetEpr, getOutflowConfigurationWithRefs(),
+ getInflowConfigurationWithRefs(),
+ getPropertyRefs()});
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Error in introperating with " + targetEpr
+ + ", client configuration: " + getClientRepo());
+ }
+ }
+ }
+
protected abstract OutflowConfiguration getOutflowConfiguration();
protected abstract InflowConfiguration getInflowConfiguration();
+ protected abstract OutflowConfiguration getOutflowConfigurationWithRefs();
+
+ protected abstract InflowConfiguration getInflowConfigurationWithRefs();
+
+ protected abstract Hashtable getPropertyRefs();
+
protected abstract String getClientRepo();
protected abstract String getServiceRepo();
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java Fri Jul 21 12:57:13 2006
@@ -20,6 +20,9 @@
import org.apache.rampart.handler.config.InflowConfiguration;
import org.apache.rampart.handler.config.OutflowConfiguration;
+import java.util.Hashtable;
+import java.util.Properties;
+
/**
* Testing optimizing the base 64 elements with
@@ -65,5 +68,51 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
+
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ OutflowConfiguration ofc = new OutflowConfiguration();
+
+ ofc.setActionItems("Signature Encrypt Timestamp");
+ ofc.setUser("alice");
+ ofc.setEncryptionUser("bob");
+ ofc.setSignaturePropRefId("key1");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setSignatureKeyIdentifier(WSSHandlerConstants.BST_DIRECT_REFERENCE);
+ ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+ ofc.setOptimizeParts("//xenc:EncryptedData/xenc:CipherData/" +
+ "xenc:CipherValue");
+
+ return ofc;
+ }
+
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ InflowConfiguration ifc = new InflowConfiguration();
+
+ ifc.setActionItems("Signature Encrypt Timestamp");
+ ifc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ifc.setSignaturePropRefId("key2");
+
+ return ifc;
+ }
+
+ protected Hashtable getPropertyRefs() {
+ Properties prop1 = new Properties();
+ prop1.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Properties prop2 = new Properties();
+ prop2.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Hashtable table = new Hashtable();
+ table.put("key1", prop1);
+ table.put("key2", prop2);
+
+ return table;
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java Fri Jul 21 12:57:13 2006
@@ -19,6 +19,8 @@
import org.apache.rampart.handler.config.InflowConfiguration;
import org.apache.rampart.handler.config.OutflowConfiguration;
+import java.util.Hashtable;
+
/**
* WS-Security interop scenario 1
@@ -49,5 +51,17 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
+
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ return null;
+ }
+
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ return null;
+ }
+
+ protected Hashtable getPropertyRefs() {
+ return null;
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java Fri Jul 21 12:57:13 2006
@@ -21,6 +21,9 @@
import org.apache.rampart.handler.config.OutflowConfiguration;
import org.apache.ws.security.WSConstants;
+import java.util.Hashtable;
+import java.util.Properties;
+
/**
* WS-Security inteorp scenario 2
*/
@@ -58,4 +61,45 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.security.InteropTestBase#getOutflowConfigurationWithRefs()
+ */
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ OutflowConfiguration ofc = new OutflowConfiguration();
+
+ ofc.setActionItems("UsernameToken Encrypt");
+ ofc.setUser("Chris");
+ ofc.setAddUTElements("Nonce Created");
+ ofc.setEncryptionParts("{Element}{" + WSSE_NS + "}UsernameToken");
+ ofc.setEncryptionUser("bob");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setEncryptionSymAlgorithm(WSConstants.TRIPLE_DES);
+ ofc.setPasswordType(WSConstants.PW_TEXT);
+ ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+
+ ofc.setEncryptionPropRefId("key1");
+
+ return ofc;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.security.InteropTestBase#getInflowConfigurationWithRefs()
+ */
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ return null;
+ }
+
+ protected Hashtable getPropertyRefs() {
+ Properties prop1 = new Properties();
+ prop1.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Hashtable table = new Hashtable();
+ table.put("key1", prop1);
+
+ return table;
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java Fri Jul 21 12:57:13 2006
@@ -21,6 +21,9 @@
import org.apache.rampart.handler.config.OutflowConfiguration;
import org.apache.ws.security.WSConstants;
+import java.util.Hashtable;
+import java.util.Properties;
+
/**
* WS-Security interop scenario 2a
@@ -57,4 +60,39 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
+
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ OutflowConfiguration ofc = new OutflowConfiguration();
+
+ ofc.setActionItems("UsernameTokenSignature Encrypt Timestamp");
+ ofc.setUser("Chris");
+ ofc.setEncryptionParts("{Element}{" + WSSE_NS + "}UsernameToken");
+ ofc.setEncryptionUser("bob");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setEncryptionSymAlgorithm(WSConstants.TRIPLE_DES);
+ ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+
+ ofc.setEncryptionPropRefId("key1");
+
+ return ofc;
+ }
+
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ return null;
+ }
+
+ protected Hashtable getPropertyRefs() {
+
+ Properties prop1 = new Properties();
+ prop1.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Hashtable table = new Hashtable();
+ table.put("key1", prop1);
+
+ return table;
+
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java Fri Jul 21 12:57:13 2006
@@ -21,6 +21,9 @@
import org.apache.rampart.handler.config.OutflowConfiguration;
import org.apache.ws.security.WSConstants;
+import java.util.Hashtable;
+import java.util.Properties;
+
/**
* WS-Security interop scenario 3
*/
@@ -62,6 +65,54 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
+
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ OutflowConfiguration ofc = new OutflowConfiguration();
+
+ ofc.setActionItems("Signature Encrypt Timestamp");
+ ofc.setUser("alice");
+ ofc.setEncryptionUser("bob");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setEncryptionSymAlgorithm(WSConstants.TRIPLE_DES);
+ ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+ ofc.setSignatureKeyIdentifier(WSSHandlerConstants.BST_DIRECT_REFERENCE);
+ ofc.setEnableSignatureConfirmation(false);
+
+ ofc.setSignaturePropRefId("key1");
+
+ return ofc;
+ }
+
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ InflowConfiguration ifc = new InflowConfiguration();
+ ifc.setActionItems("Signature Encrypt Timestamp");
+ ifc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ifc.setEnableSignatureConfirmation(false);
+
+ ifc.setSignaturePropRefId("key2");
+
+ return ifc;
+ }
+
+ protected Hashtable getPropertyRefs() {
+ Properties prop1 = new Properties();
+ prop1.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Properties prop2 = new Properties();
+ prop2.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Hashtable table = new Hashtable();
+ table.put("key1", prop1);
+ table.put("key2", prop2);
+
+ return table;
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java Fri Jul 21 12:57:13 2006
@@ -21,6 +21,9 @@
import org.apache.rampart.handler.config.OutflowConfiguration;
import org.apache.ws.security.WSConstants;
+import java.util.Hashtable;
+import java.util.Properties;
+
/**
* WS-Security interop scenario 4
*/
@@ -63,5 +66,53 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
+
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ OutflowConfiguration ofc = new OutflowConfiguration();
+
+ ofc.setActionItems("Signature Encrypt Timestamp");
+ ofc.setUser("alice");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setEncryptionSymAlgorithm(WSConstants.TRIPLE_DES);
+ ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.EMBEDDED_KEYNAME);
+ ofc.setEmbeddedKeyName("SessionKey");
+ ofc.setSignatureKeyIdentifier(WSSHandlerConstants.BST_DIRECT_REFERENCE);
+ ofc.setEmbeddedKeyCallbackClass("org.apache.axis2.security.PWCallback");
+
+ ofc.setSignaturePropRefId("key1");
+
+ return ofc;
+ }
+
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ InflowConfiguration ifc = new InflowConfiguration();
+
+ ifc.setActionItems("Signature Encrypt Timestamp");
+ ifc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+
+ ifc.setSignaturePropRefId("key2");
+
+ return ifc;
+ }
+
+ protected Hashtable getPropertyRefs() {
+ Properties prop1 = new Properties();
+ prop1.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Properties prop2 = new Properties();
+ prop2.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Hashtable table = new Hashtable();
+ table.put("key1", prop1);
+ table.put("key2", prop2);
+
+ return table;
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java Fri Jul 21 12:57:13 2006
@@ -20,6 +20,9 @@
import org.apache.rampart.handler.config.InflowConfiguration;
import org.apache.rampart.handler.config.OutflowConfiguration;
+import java.util.Hashtable;
+import java.util.Properties;
+
/**
* WS-Security interop scenario 5
*/
@@ -60,4 +63,50 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
+
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ OutflowConfiguration ofc = new OutflowConfiguration(2);
+
+ ofc.setActionItems("Signature NoSerialization");
+ ofc.setUser("alice");
+ ofc.setSignaturePropRefId("key1");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setSignatureKeyIdentifier(WSSHandlerConstants.BST_DIRECT_REFERENCE);
+ ofc.setSignatureParts("{}{http://xmlsoap.org/Ping}ticket");
+
+ ofc.nextAction();
+
+ ofc.setActionItems("Signature Timestamp");
+ ofc.setUser("alice");
+ ofc.setSignaturePropRefId("key2");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+
+ return ofc;
+ }
+
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ return null;
+ }
+
+ protected Hashtable getPropertyRefs() {
+ Properties prop1 = new Properties();
+ prop1.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Properties prop2 = new Properties();
+ prop2.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Hashtable table = new Hashtable();
+ table.put("key1", prop1);
+
+ //IMPORTANT: Note that the key of the first repetition has "1" appended to it
+ table.put("key21", prop2);
+
+ return table;
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java Fri Jul 21 12:57:13 2006
@@ -21,6 +21,9 @@
import org.apache.rampart.handler.config.OutflowConfiguration;
import org.apache.ws.security.WSConstants;
+import java.util.Hashtable;
+import java.util.Properties;
+
/**
* WS-Security interop scenario 6
*/
@@ -63,4 +66,49 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return true;
}
+
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ OutflowConfiguration ofc = new OutflowConfiguration();
+
+ ofc.setActionItems("Encrypt Signature Timestamp");
+ ofc.setUser("alice");
+ ofc.setSignaturePropRefId("key1");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setEncryptionSymAlgorithm(WSConstants.TRIPLE_DES);
+ ofc.setSignatureKeyIdentifier(WSSHandlerConstants.BST_DIRECT_REFERENCE);
+ ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+ ofc.setEmbeddedKeyCallbackClass("rg.apache.axis2.security.PWCallback");
+
+ return ofc;
+ }
+
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ InflowConfiguration ifc = new InflowConfiguration();
+
+ ifc.setActionItems("Encrypt Signature Timestamp");
+ ifc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ifc.setSignaturePropRefId("key2");
+
+ return ifc;
+ }
+
+ protected Hashtable getPropertyRefs() {
+ Properties prop1 = new Properties();
+ prop1.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Properties prop2 = new Properties();
+ prop2.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Hashtable table = new Hashtable();
+ table.put("key1", prop1);
+ table.put("key2", prop2);
+
+ return table;
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java Fri Jul 21 12:57:13 2006
@@ -22,6 +22,9 @@
import org.apache.rampart.handler.config.OutflowConfiguration;
import org.apache.ws.security.WSConstants;
+import java.util.Hashtable;
+import java.util.Properties;
+
/**
* WS-Security interop scenario 7
*/
@@ -69,4 +72,69 @@
protected boolean isUseSOAP12InStaticConfigTest() {
return false;
}
+
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ OutflowConfiguration ofc = new OutflowConfiguration();
+
+ ofc.setActionItems("Signature Encrypt Timestamp");
+ ofc.setUser("alice");
+ ofc.setEncryptionUser("bob");
+ ofc.setSignaturePropRefId("key1");
+ ofc.setEncryptionPropRefId("key2");
+ ofc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ofc.setEncryptionSymAlgorithm(WSConstants.TRIPLE_DES);
+ ofc.setSignatureKeyIdentifier(WSSHandlerConstants.BST_DIRECT_REFERENCE);
+ ofc.setEncryptionKeyIdentifier(WSSHandlerConstants.SKI_KEY_IDENTIFIER);
+ ofc.setEmbeddedKeyCallbackClass("rg.apache.axis2.security.PWCallback");
+ ofc.setSignatureParts("{}{" +
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI +
+ "}Body;STRTransform");
+
+ return ofc;
+ }
+
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ InflowConfiguration ifc = new InflowConfiguration();
+
+ ifc.setActionItems("Signature Encrypt Timestamp");
+ ifc.setPasswordCallbackClass("org.apache.axis2.security.PWCallback");
+ ifc.setSignaturePropRefId("key3");
+ ifc.setDecryptionPropRefKey("key4");
+
+ return ifc;
+ }
+
+ protected Hashtable getPropertyRefs() {
+ Properties prop1 = new Properties();
+ prop1.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop1.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Properties prop2 = new Properties();
+ prop2.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop2.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Properties prop3 = new Properties();
+ prop3.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop3.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop3.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop3.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Properties prop4 = new Properties();
+ prop4.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
+ prop4.setProperty("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
+ prop4.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "password");
+ prop4.setProperty("org.apache.ws.security.crypto.merlin.file", "interop2.jks");
+
+ Hashtable table = new Hashtable();
+ table.put("key1", prop1);
+ table.put("key2", prop2);
+ table.put("key3", prop3);
+ table.put("key4", prop4);
+
+ return table;
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java Fri Jul 21 12:57:13 2006
@@ -19,6 +19,8 @@
import org.apache.rampart.handler.config.InflowConfiguration;
import org.apache.rampart.handler.config.OutflowConfiguration;
+import java.util.Hashtable;
+
/**
* SAML Scenario 1
*/
@@ -46,5 +48,29 @@
// TODO TODO
throw new UnsupportedOperationException("TODO");
}
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.security.InteropTestBase#getOutflowConfigurationWithRefs()
+ */
+ protected OutflowConfiguration getOutflowConfigurationWithRefs() {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.security.InteropTestBase#getInflowConfigurationWithRefs()
+ */
+ protected InflowConfiguration getInflowConfigurationWithRefs() {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis2.security.InteropTestBase#getPropertyRefs()
+ */
+ protected Hashtable getPropertyRefs() {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
}
Modified: webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java (original)
+++ webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java Fri Jul 21 12:57:13 2006
@@ -30,9 +30,11 @@
import org.xmlsoap.ping.PingResponseDocument;
import org.xmlsoap.ping.TicketType;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
/**
- * Client for the interop service
- * This MUST be used with the codegen'ed classes
+ * Client for the interop service This MUST be used with the codegen'ed classes
*/
public class InteropScenarioClient {
@@ -44,7 +46,8 @@
}
}
- public void invokeWithStaticConfig(String clientRepo, String url) throws Exception {
+ public void invokeWithStaticConfig(String clientRepo, String url)
+ throws Exception {
TicketType ticket = TicketType.Factory.newInstance();
ticket.setId("My ticket Id");
@@ -55,16 +58,17 @@
PingDocument pingDoc = PingDocument.Factory.newInstance();
pingDoc.setPing(ping);
- PingPortStub stub = new PingPortStub(
- ConfigurationContextFactory.createConfigurationContextFromFileSystem(
- clientRepo, clientRepo +"/conf/axis2.xml"), url);
-
- //Enable MTOM to those scenarios where they are configured using:
- //<optimizeParts>xpathExpression</optimizeParts>
- stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+ PingPortStub stub = new PingPortStub(ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(clientRepo,
+ clientRepo + "/conf/axis2.xml"), url);
+
+ // Enable MTOM to those scenarios where they are configured using:
+ // <optimizeParts>xpathExpression</optimizeParts>
+ stub._getServiceClient().getOptions().setProperty(
+ Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
stub._getServiceClient().getOptions().setSoapVersionURI(soapNsURI);
- stub._getServiceClient().engageModule(new javax.xml.namespace.QName("rampart"));
-
+ stub._getServiceClient().engageModule(
+ new javax.xml.namespace.QName("rampart"));
PingResponseDocument pingResDoc = stub.Ping(pingDoc);
@@ -73,9 +77,9 @@
System.out.println(pingRes.getText());
}
- public void invokeWithGivenConfig(String clientRepo,
- String url, OutflowConfiguration outflowConfig,
- InflowConfiguration inflowConfig) throws Exception {
+ public void invokeWithGivenConfig(String clientRepo, String url,
+ OutflowConfiguration outflowConfig, InflowConfiguration inflowConfig)
+ throws Exception {
TicketType ticket = TicketType.Factory.newInstance();
ticket.setId("My ticket Id");
@@ -86,22 +90,83 @@
PingDocument pingDoc = PingDocument.Factory.newInstance();
pingDoc.setPing(ping);
- PingPortStub stub = new PingPortStub(
- ConfigurationContextFactory.createConfigurationContextFromFileSystem(clientRepo, clientRepo +"/conf/axis2.xml"), url);
+ PingPortStub stub = new PingPortStub(ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(clientRepo,
+ clientRepo + "/conf/axis2.xml"), url);
+
+ // Enable MTOM to those scenarios where they are configured using:
+ // <optimizeParts>xpathExpression</optimizeParts>
+ stub._getServiceClient().getOptions().setProperty(
+ Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+ // Engage the security module
+ stub._getServiceClient().engageModule(
+ new javax.xml.namespace.QName("rampart"));
- //Enable MTOM to those scenarios where they are configured using:
- //<optimizeParts>xpathExpression</optimizeParts>
- stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
- //Engage the security module
- stub._getServiceClient().engageModule(new javax.xml.namespace.QName("rampart"));
+ if (outflowConfig != null) {
+ stub._getServiceClient().getOptions().setProperty(
+ WSSHandlerConstants.OUTFLOW_SECURITY,
+ outflowConfig.getProperty());
+ }
+ if (inflowConfig != null) {
+ stub._getServiceClient().getOptions().setProperty(
+ WSSHandlerConstants.INFLOW_SECURITY,
+ inflowConfig.getProperty());
+ }
+ PingResponseDocument pingResDoc = stub.Ping(pingDoc);
+ PingResponse pingRes = pingResDoc.getPingResponse();
+
+ System.out.println(pingRes.getText());
+ stub = null;
+ }
+
+ public void invokeWithGivenConfigWithProRefs(String clientRepo, String url,
+ OutflowConfiguration outflowConfig, InflowConfiguration inflowConfig,
+ Hashtable propRefs)
+ throws Exception {
+ TicketType ticket = TicketType.Factory.newInstance();
+ ticket.setId("My ticket Id");
+
+ Ping ping = Ping.Factory.newInstance();
+ ping.setText("Testing axis2-wss4j module");
+ ping.setTicket(ticket);
+
+ PingDocument pingDoc = PingDocument.Factory.newInstance();
+ pingDoc.setPing(ping);
+
+ PingPortStub stub = new PingPortStub(ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(clientRepo,
+ clientRepo + "/conf/axis2.xml"), url);
+
+ // Enable MTOM to those scenarios where they are configured using:
+ // <optimizeParts>xpathExpression</optimizeParts>
+ stub._getServiceClient().getOptions().setProperty(
+ Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+ // Engage the security module
+ stub._getServiceClient().engageModule(
+ new javax.xml.namespace.QName("rampart"));
if (outflowConfig != null) {
- stub._getServiceClient().getOptions().setProperty(WSSHandlerConstants.OUTFLOW_SECURITY, outflowConfig.getProperty());
+ stub._getServiceClient().getOptions().setProperty(
+ WSSHandlerConstants.OUTFLOW_SECURITY,
+ outflowConfig.getProperty());
}
if (inflowConfig != null) {
- stub._getServiceClient().getOptions().setProperty(WSSHandlerConstants.INFLOW_SECURITY, inflowConfig.getProperty());
+ stub._getServiceClient().getOptions().setProperty(
+ WSSHandlerConstants.INFLOW_SECURITY,
+ inflowConfig.getProperty());
+ }
+
+ if(propRefs != null) {
+ Enumeration keysEnum = propRefs.keys();
+ while (keysEnum.hasMoreElements()) {
+ String refKey = (String) keysEnum.nextElement();
+
+ stub._getServiceClient().getOptions().setProperty(refKey,
+ propRefs.get(refKey));
+ }
}
+
PingResponseDocument pingResDoc = stub.Ping(pingDoc);
PingResponse pingRes = pingResDoc.getPingResponse();
@@ -109,5 +174,4 @@
System.out.println(pingRes.getText());
stub = null;
}
-
}
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/InflowConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/InflowConfiguration.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/InflowConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/InflowConfiguration.java Fri Jul 21 12:57:13 2006
@@ -111,6 +111,14 @@
public void setDecryptionPropFile(String decryptionPropFile) {
this.action.put(WSHandlerConstants.DEC_PROP_FILE,decryptionPropFile);
}
+
+ /**
+ * Sets the decryption property ref key.
+ * @param decryptionPropFile
+ */
+ public void setDecryptionPropRefKey(String decryptionPropRefKey) {
+ this.action.put(WSHandlerConstants.DEC_PROP_REF_ID,decryptionPropRefKey);
+ }
/**
* Returns the password callback class name.
@@ -143,6 +151,14 @@
public void setSignaturePropFile(String signaturePropFile) {
this.action.put(WSHandlerConstants.SIG_PROP_FILE, signaturePropFile);
}
+
+ /**
+ * Sets the signature property ref key.
+ * @param signaturePropFile
+ */
+ public void setSignaturePropRefId(String signaturePropRefId) {
+ this.action.put(WSHandlerConstants.SIG_PROP_REF_ID, signaturePropRefId);
+ }
/**
* Sets whether signature confirmation should be enabled or not.
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/OutflowConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/OutflowConfiguration.java?rev=424439&r1=424438&r2=424439&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/OutflowConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/config/OutflowConfiguration.java Fri Jul 21 12:57:13 2006
@@ -205,6 +205,16 @@
WSHandlerConstants.SIG_PROP_FILE, signaturePropFile);
}
+ /**
+ * Sets the signature property ref key of the current action.
+ *
+ * @param signaturePropRefId
+ */
+ public void setSignaturePropRefId(String signaturePropRefId) {
+ this.actionList[this.currentAction].put(
+ WSHandlerConstants.SIG_PROP_REF_ID, signaturePropRefId);
+ }
+
/**
* Returns the signature property file of the current action.
* @return Returns String.
@@ -465,6 +475,16 @@
WSHandlerConstants.ENC_PROP_FILE, encPropFile);
}
+ /**
+ * Sets the encryption property ref key of the current action.
+ *
+ * @param encryptionPropRefId
+ */
+ public void setEncryptionPropRefId(String encryptionPropRefId) {
+ this.actionList[this.currentAction].put(
+ WSHandlerConstants.ENC_PROP_REF_ID, encryptionPropRefId);
+ }
+
/**
* Returns the encryption property file.
* @return Returns String.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org