Author: asankha
Date: Sun Jun 11 22:15:01 2006
New Revision: 413582
URL: http://svn.apache.org/viewvc?rev=413582&view=rev
Log:
Fix issues related to integration with Rampart
Fix bug to allow concurrent handling with module engage/disengage on send
Add WS-Sec sample based on interop endpoint
Added:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/RampartSecurityBuilder.java
- copied, changed from r412912,
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/OutflowSecurityBuilder.java
incubator/synapse/trunk/java/modules/samples/src/samples/qos/
incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/
incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/SecurityInteropClient.java
incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/WSSecInteropPWCallback.java
incubator/synapse/trunk/java/repository/conf/sample/WSSTest1.pfx.p12
(with props)
incubator/synapse/trunk/java/repository/conf/sample/WSSTest2.pfx.p12
(with props)
incubator/synapse/trunk/java/repository/conf/sample/interop-client.properties
incubator/synapse/trunk/java/repository/conf/sample/interop-server.properties
Removed:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/OutflowSecurityBuilder.java
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Endpoint.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/Constants.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java
incubator/synapse/trunk/java/project.properties
incubator/synapse/trunk/java/project.xml
incubator/synapse/trunk/java/repository/conf/axis2.xml
incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_4.xml
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/Constants.java
Sun Jun 11 22:15:01 2006
@@ -62,6 +62,9 @@
/** The message context property name which holds the Security 'Parameter'
object to be used for outgoing messages */
String OUTFLOW_SEC_PARAMETER = "OUTFLOW_SEC_PARAMETER";
+ /** The message context property name which holds the Security 'Parameter'
object to be used for incoming messages */
+ String INFLOW_SEC_PARAMETER = "INFLOW_SEC_PARAMETER";
+
// -- names of modules to be engaged at runtime --
/** The QName of the WS-RM Sandesha module */
QName SANDESHA2_MODULE_NAME = new QName("sandesha2");
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Endpoint.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Endpoint.java?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Endpoint.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Endpoint.java
Sun Jun 11 22:15:01 2006
@@ -35,12 +35,18 @@
private URL address = null;
/** The name of the actual endpoint to which this instance refers to */
private String ref = null;
- /** Should messages be sent in an RM Sequence ? */
+ /** Should messages be sent in an WS-RM Sequence ? */
private boolean reliableMessagingOn = false;
+ /** Should messages be sent using WS-A? */
+ private boolean addressingOn = false;
+ /** Should messages be sent using WS-Security? */
+ private boolean securityOn = false;
/** Any WS-RM Policy overrides to be used when communicating with this
endpoint */
private Policy wsRMPolicy = null;
/** The Apache Rampart OutflowSecurity configuration to be used */
private Parameter outflowSecurity = null;
+ /** The Apache Rampart InflowSecurity configuration to be used */
+ private Parameter inflowSecurity = null;
/**
* Return the name of the endpoint
@@ -107,6 +113,38 @@
}
/**
+ * Is WS-A turned on on this endpoint?
+ * @return true if on
+ */
+ public boolean isAddressingOn() {
+ return addressingOn;
+ }
+
+ /**
+ * Request that WS-A be turned on/off on this endpoint
+ * @param addressingOn
+ */
+ public void setAddressingOn(boolean addressingOn) {
+ this.addressingOn = addressingOn;
+ }
+
+ /**
+ * Is WS-Security turned on on this endpoint?
+ * @return true if on
+ */
+ public boolean isSecurityOn() {
+ return securityOn;
+ }
+
+ /**
+ * Request that WS-Sec be turned on/off on this endpoint
+ * @param securityOn
+ */
+ public void setSecurityOn(boolean securityOn) {
+ this.securityOn = securityOn;
+ }
+
+ /**
* Return the OutflowSecurity configuration to be used (See Rampart)
* @return the OutflowSecurity to be used, or null if WS-Sec is not on
*/
@@ -120,6 +158,22 @@
*/
public void setOutflowSecurity(Parameter outflowSecurity) {
this.outflowSecurity = outflowSecurity;
+ }
+
+ /**
+ * Return the InflowSecurity configuration to be used (See Rampart)
+ * @return the InflowSecurity to be used, or null if WS-Sec is not on
+ */
+ public Parameter getInflowSecurity() {
+ return inflowSecurity;
+ }
+
+ /**
+ * Set the InflowSecurity configuration to be used (See Apache Rampart)
+ * @param inflowSecurity the Rampart InflowSecurity configuration to be
used if any
+ */
+ public void setInflowSecurity(Parameter inflowSecurity) {
+ this.inflowSecurity = inflowSecurity;
}
/**
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/Constants.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/Constants.java?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/Constants.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/Constants.java
Sun Jun 11 22:15:01 2006
@@ -32,4 +32,5 @@
public static final String SYNAPSE_NAMESPACE =
org.apache.synapse.Constants.SYNAPSE_NAMESPACE;
public static final String NULL_NAMESPACE = "";
public static final String OUTFLOW_SECURITY = "OutflowSecurity";
+ public static final String INFLOW_SECURITY = "InflowSecurity";
}
Copied:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/RampartSecurityBuilder.java
(from r412912,
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/OutflowSecurityBuilder.java)
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/RampartSecurityBuilder.java?p2=incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/RampartSecurityBuilder.java&p1=incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/OutflowSecurityBuilder.java&r1=412912&r2=413582&rev=413582&view=diff
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/OutflowSecurityBuilder.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/RampartSecurityBuilder.java
Sun Jun 11 22:15:01 2006
@@ -27,9 +27,9 @@
* Build an Apache Rampart OutflowSecurity Parameter using the given
* XML fragment from a Synapse configuration file.
*/
-public class OutflowSecurityBuilder {
+public class RampartSecurityBuilder {
- private static final Log log =
LogFactory.getLog(OutflowSecurityBuilder.class);
+ private static final Log log =
LogFactory.getLog(RampartSecurityBuilder.class);
/**
* Return a Rampart OutflowSecurity 'Parameter', by scanning the children
of the
@@ -37,13 +37,14 @@
* @param elem the source element to be used
* @return a Rampart OutflowSecurity 'Parameter'
*/
- public static Parameter getOutflowSecurity(OMElement elem) {
- OMElement paramElt = elem.getFirstChildWithName(new
QName(Constants.NULL_NAMESPACE, "parameter"));
+ public static Parameter getSecurityParameter(OMElement elem, String name) {
+ OMElement paramElt = elem.getFirstChildWithName(
+ new QName(Constants.NULL_NAMESPACE, "parameter"));
if (paramElt != null) {
Parameter param = new Parameter();
param.setParameterElement(paramElt);
param.setValue(paramElt);
- param.setName(Constants.OUTFLOW_SECURITY);
+ param.setName(name);
return param;
} else {
return null;
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
Sun Jun 11 22:15:01 2006
@@ -175,8 +175,26 @@
handleException("The 'address' attribute is required for an
endpoint");
}
+ OMAttribute wsAddr = ele.getAttribute(new
QName(Constants.NULL_NAMESPACE, "useWSA"));
+ if (wsAddr != null) {
+
endpoint.setAddressingOn(Boolean.parseBoolean(wsAddr.getAttributeValue()));
+ }
+ OMAttribute wsSec = ele.getAttribute(new
QName(Constants.NULL_NAMESPACE, "useWSSec"));
+ if (wsSec != null) {
+
endpoint.setSecurityOn(Boolean.parseBoolean(wsSec.getAttributeValue()));
+ }
+ OMAttribute wsRm = ele.getAttribute(new
QName(Constants.NULL_NAMESPACE, "useWSRM"));
+ if (wsRm != null) {
+
endpoint.setReliableMessagingOn(Boolean.parseBoolean(wsRm.getAttributeValue()));
+ }
+
// if a Rampart OutflowSecurity parameter is specified, digest it
-
endpoint.setOutflowSecurity(OutflowSecurityBuilder.getOutflowSecurity(ele));
+ endpoint.setOutflowSecurity(
+ RampartSecurityBuilder.getSecurityParameter(ele,
Constants.OUTFLOW_SECURITY));
+
+ // if a Rampart InflowSecurity parameter is specified, digest it
+ endpoint.setInflowSecurity(
+ RampartSecurityBuilder.getSecurityParameter(ele,
Constants.INFLOW_SECURITY));
// if WS-RM is enabled, set it as requested
endpoint.setReliableMessagingOn(OutflowRMPolicyBuilder.isRMEnabled(ele));
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
Sun Jun 11 22:15:01 2006
@@ -32,7 +32,6 @@
import org.apache.axis2.util.UUIDGenerator;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
import org.apache.ws.policy.Policy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -58,7 +57,7 @@
*
* @param wsAddressingEnabled
* @param wsSecurityEnabled
- * @param wsSecurityParameter
+ * @param outflowSecurityParameter
* @param wsRMEnabled
* @param wsRMPolicy
* @param axisMsgCtx
@@ -67,7 +66,8 @@
public static MessageContext send(
boolean wsAddressingEnabled,
boolean wsSecurityEnabled,
- Parameter wsSecurityParameter,
+ Parameter outflowSecurityParameter,
+ Parameter inflowSecurityParameter,
boolean wsRMEnabled,
Policy wsRMPolicy,
MessageContext axisMsgCtx) throws AxisFault {
@@ -103,12 +103,21 @@
addPolicyElement(PolicyInclude.OPERATION_POLICY, wsRMPolicy);
}
- // if security is enabled, and if a WS-Sec OutflowSecurity parameter is
- // specified, use it
- if (wsSecurityEnabled && wsSecurityParameter != null) {
- clientOptions.setProperty(
+ // if security is enabled,
+ if (wsSecurityEnabled) {
+ // if a WS-Sec OutflowSecurity parameter is specified, use it
+ if (outflowSecurityParameter != null) {
+ clientOptions.setProperty(
org.apache.synapse.config.xml.Constants.OUTFLOW_SECURITY,
- wsSecurityParameter);
+ outflowSecurityParameter);
+ }
+
+ // if a WS-Sec InflowSecurity parameter is specified, use it
+ if (inflowSecurityParameter != null) {
+ clientOptions.setProperty(
+ org.apache.synapse.config.xml.Constants.INFLOW_SECURITY,
+ inflowSecurityParameter);
+ }
}
OperationClient mepClient = axisAnonymousOperation.createClient(
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/Axis2Sender.java
Sun Jun 11 22:15:01 2006
@@ -48,8 +48,8 @@
MessageContext axisOutMsgContext =
Axis2FlexibleMEPClient.send(
- // WS-A default is on
- (wsAOn == null || wsAOn.booleanValue()),
+ // WS-A default is off
+ (wsAOn != null && wsAOn.booleanValue()),
// WS-Sec default is off
(wsSecOn != null && wsSecOn.booleanValue()),
@@ -57,6 +57,10 @@
// The OutflowSecurity Parameter
(Parameter) synapseInMessageContext.getProperty(
Constants.OUTFLOW_SEC_PARAMETER),
+
+ // The InflowSecurity Parameter
+ (Parameter) synapseInMessageContext.getProperty(
+ Constants.INFLOW_SEC_PARAMETER),
// WS-RM default is off
(wsRmOn != null && wsRmOn.booleanValue()),
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
Sun Jun 11 22:15:01 2006
@@ -73,7 +73,9 @@
((Axis2MessageContext) synCtx).getAxis2MessageContext();
org.apache.axis2.context.MessageContext axisOutMsgContext =
Axis2FlexibleMEPClient.send(
- false, false, endpoint.getOutflowSecurity(),
+ false, false,
+ endpoint.getOutflowSecurity(),
+ endpoint.getInflowSecurity(),
endpoint.isReliableMessagingOn(),
endpoint.getWsRMPolicy(),
axisInMsgContext);
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java
Sun Jun 11 22:15:01 2006
@@ -92,12 +92,28 @@
// if RM is turned on
if (singleEndpoint.isReliableMessagingOn()) {
synCtx.setProperty(Constants.OUTFLOW_RM_ON, Boolean.TRUE);
- synCtx.setProperty(Constants.OUTFLOW_RM_POLICY,
singleEndpoint.getWsRMPolicy());
+ if (singleEndpoint.getWsRMPolicy() != null) {
+ synCtx.setProperty(Constants.OUTFLOW_RM_POLICY,
+ singleEndpoint.getWsRMPolicy());
+ }
}
// if WS Security is specified
- if (singleEndpoint.getOutflowSecurity() != null) {
- synCtx.setProperty(Constants.OUTFLOW_SEC_PARAMETER,
singleEndpoint.getOutflowSecurity());
+ if (singleEndpoint.isSecurityOn()) {
+ synCtx.setProperty(Constants.OUTFLOW_SECURITY_ON,
Boolean.TRUE);
+ if (singleEndpoint.getOutflowSecurity() != null) {
+ synCtx.setProperty(Constants.OUTFLOW_SEC_PARAMETER,
+ singleEndpoint.getOutflowSecurity());
+ }
+ if (singleEndpoint.getInflowSecurity() != null) {
+ synCtx.setProperty(Constants.INFLOW_SEC_PARAMETER,
+ singleEndpoint.getInflowSecurity());
+ }
+ }
+
+ // if WS Addressing is specified
+ if (singleEndpoint.isAddressingOn()) {
+ synCtx.setProperty(Constants.OUTFLOW_ADDRESSING_ON,
Boolean.TRUE);
}
synCtx.getEnvironment().send(synCtx);
Added:
incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/SecurityInteropClient.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/SecurityInteropClient.java?rev=413582&view=auto
==============================================================================
---
incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/SecurityInteropClient.java
(added)
+++
incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/SecurityInteropClient.java
Sun Jun 11 22:15:01 2006
@@ -0,0 +1,66 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package samples.qos.security;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.MessageContextConstants;
+
+import javax.xml.namespace.QName;
+
+public class SecurityInteropClient {
+
+ private static final String TURL = "http://localhost:8080/";
+ private static final String PING1_ACTION = "Ping1";
+ private static final String PING3_ACTION = "Ping3";
+ private static final String PING_NS = "http://xmlsoap.org/Ping";
+
+ public static void main(String[] args) {
+ send("Hello World", TURL, PING1_ACTION);
+ //send("Hello World", TURL, PING3_ACTION);
+ }
+
+ private static void send(String echoText, String turl, String soapAction) {
+ try {
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMNamespace xNs = factory.createOMNamespace(PING_NS, "");
+ OMElement ping = factory.createOMElement("Ping", xNs);
+ OMElement text = factory.createOMElement("text", xNs);
+ text.setText(echoText);
+ ping.addChild(text);
+
+ ServiceClient serviceClient = new ServiceClient();
+ Options options = new Options();
+
+ options.setProperty(MessageContextConstants.TRANSPORT_URL, turl);
+ options.setAction(soapAction);
+ serviceClient.setOptions(options);
+ OMElement result = serviceClient.sendReceive(ping);
+
+ QName gQR = new QName(PING_NS, "PingResponse");
+ OMElement qResp = (OMElement)
result.getChildrenWithName(gQR).next();
+ System.out.println("Response : " + qResp.getText());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added:
incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/WSSecInteropPWCallback.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/WSSecInteropPWCallback.java?rev=413582&view=auto
==============================================================================
---
incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/WSSecInteropPWCallback.java
(added)
+++
incubator/synapse/trunk/java/modules/samples/src/samples/qos/security/WSSecInteropPWCallback.java
Sun Jun 11 22:15:01 2006
@@ -0,0 +1,101 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package samples.qos.security;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import java.io.IOException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+public class WSSecInteropPWCallback implements CallbackHandler {
+
+ /**
+ * Field key
+ */
+ private static final byte[] key = {
+ (byte) 0x31, (byte) 0xfd, (byte) 0xcb, (byte) 0xda, (byte) 0xfb,
+ (byte) 0xcd, (byte) 0x6b, (byte) 0xa8, (byte) 0xe6, (byte) 0x19,
+ (byte) 0xa7, (byte) 0xbf, (byte) 0x51, (byte) 0xf7, (byte) 0xc7,
+ (byte) 0x3e, (byte) 0x80, (byte) 0xae, (byte) 0x98, (byte) 0x51,
+ (byte) 0xc8, (byte) 0x51, (byte) 0x34, (byte) 0x04,
+ };
+
+ /**
+ * Method handle
+ *
+ * @param callbacks
+ * @throws java.io.IOException
+ * @throws javax.security.auth.callback.UnsupportedCallbackException
+ *
+ */
+
+ public void handle(Callback[] callbacks)
+ throws IOException, UnsupportedCallbackException {
+
+ for (int i = 0; i < callbacks.length; i++) {
+ if (callbacks[i] instanceof WSPasswordCallback) {
+ WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
+ /*
+ * This usage type is used only in case we received a
+ * username token with a password of type PasswordText or
+ * an unknown password type.
+ *
+ * This case the WSPasswordCallback object contains the
+ * identifier (aka username), the password we received, and
+ * the password type string to identify the type.
+ *
+ * Here we perform only a very simple check.
+ */
+ if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN)
+ {
+ if (pc.getIdentifer().equals("Ron") &&
pc.getPassword().equals("noR"))
+ {
+ return;
+ }
+ if (pc.getPassword().equals("sirhC")) {
+ return;
+ }
+ throw new UnsupportedCallbackException(callbacks[i],
+ "check failed");
+ }
+ /*
+ * here call a function/method to lookup the password for
+ * the given identifier (e.g. a user name or keystore alias)
+ * e.g.:
pc.setPassword(passStore.getPassword(pc.getIdentfifier))
+ * for Testing we supply a fixed name here.
+ */
+ if (pc.getUsage() == WSPasswordCallback.KEY_NAME) {
+ pc.setKey(key);
+ } else if (pc.getIdentifer().equals("alice")) {
+ pc.setPassword("password");
+ } else if (pc.getIdentifer().equals("bob")) {
+ pc.setPassword("password");
+ } else if (pc.getIdentifer().equals("Ron")) {
+ pc.setPassword("noR");
+ } else if (pc.getIdentifer().equals("Chris")) {
+ pc.setPassword("sirhC");
+ } else {
+ pc.setPassword("changeit");
+ }
+ } else {
+ throw new UnsupportedCallbackException(callbacks[i],
+ "Unrecognized Callback");
+ }
+ }
+ }
+}
Modified: incubator/synapse/trunk/java/project.properties
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/project.properties?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
--- incubator/synapse/trunk/java/project.properties (original)
+++ incubator/synapse/trunk/java/project.properties Sun Jun 11 22:15:01 2006
@@ -41,6 +41,8 @@
# -------------------------------------------------------------------
ant.version=1.6.5
axis.wsdl4j.version=1.2
+wss4j.version=SNAPSHOT
+xmlsec.version=1.3.0
wsdl4j.version=1.5.2
axis2.version=SNAPSHOT
Modified: incubator/synapse/trunk/java/project.xml
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/project.xml?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
--- incubator/synapse/trunk/java/project.xml (original)
+++ incubator/synapse/trunk/java/project.xml Sun Jun 11 22:15:01 2006
@@ -85,6 +85,24 @@
</properties>
</dependency>
+ <dependency>
+ <groupId>wss4j</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>${wss4j.version}</version>
+ <properties>
+ <module>false</module>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>xml-security</groupId>
+ <artifactId>xmlsec</artifactId>
+ <version>${xmlsec.version}</version>
+ <properties>
+ <module>false</module>
+ </properties>
+ </dependency>
+
<!-- external MARs -->
<dependency>
<groupId>axis2</groupId>
Modified: incubator/synapse/trunk/java/repository/conf/axis2.xml
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/axis2.xml?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
--- incubator/synapse/trunk/java/repository/conf/axis2.xml (original)
+++ incubator/synapse/trunk/java/repository/conf/axis2.xml Sun Jun 11 22:15:01
2006
@@ -23,7 +23,7 @@
<!-- ==================================================== -->
<parameter name="Sandesha2StorageManager"
locked="false">inmemory</parameter>
<module ref="addressing"/>
- <!-- <module ref="rampart"/> -->
+ <module ref="rampart"/>
<module ref="synapse"/>
<!-- ==================================================== -->
@@ -73,7 +73,7 @@
<transportSender name="http"
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
<parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
- <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ <!--<parameter name="Transfer-Encoding"
locked="false">chunked</parameter>-->
</transportSender>
<transportSender name="https"
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
Added: incubator/synapse/trunk/java/repository/conf/sample/WSSTest1.pfx.p12
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/WSSTest1.pfx.p12?rev=413582&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/synapse/trunk/java/repository/conf/sample/WSSTest1.pfx.p12
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/synapse/trunk/java/repository/conf/sample/WSSTest2.pfx.p12
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/WSSTest2.pfx.p12?rev=413582&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/synapse/trunk/java/repository/conf/sample/WSSTest2.pfx.p12
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/synapse/trunk/java/repository/conf/sample/interop-client.properties
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/interop-client.properties?rev=413582&view=auto
==============================================================================
---
incubator/synapse/trunk/java/repository/conf/sample/interop-client.properties
(added)
+++
incubator/synapse/trunk/java/repository/conf/sample/interop-client.properties
Sun Jun 11 22:15:01 2006
@@ -0,0 +1,4 @@
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=pkcs12
+org.apache.ws.security.crypto.merlin.keystore.password=changeit
+org.apache.ws.security.crypto.merlin.file=WSSTest1.pfx.p12
Added:
incubator/synapse/trunk/java/repository/conf/sample/interop-server.properties
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/interop-server.properties?rev=413582&view=auto
==============================================================================
---
incubator/synapse/trunk/java/repository/conf/sample/interop-server.properties
(added)
+++
incubator/synapse/trunk/java/repository/conf/sample/interop-server.properties
Sun Jun 11 22:15:01 2006
@@ -0,0 +1,5 @@
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=pkcs12
+org.apache.ws.security.crypto.merlin.keystore.password=changeit
+org.apache.ws.security.crypto.merlin.file=WSSTest2.pfx.p12
+
Modified:
incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_4.xml
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_4.xml?rev=413582&r1=413581&r2=413582&view=diff
==============================================================================
--- incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_4.xml
(original)
+++ incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_4.xml
Sun Jun 11 22:15:01 2006
@@ -1,18 +1,41 @@
<synapse xmlns="http://ws.apache.org/ns/synapse">
<definitions>
- <sequence name="stockquote">
- <!-- set correlation field to custom label -->
- <set-property name="correlate/label" value="stockquote"/>
- <send>
- <endpoint ref="invesbot"/>
- </send>
- </sequence>
-
- <endpoint name="invesbot"
address="http://ws.invesbot.com/stockquotes.asmx">
+
+ <endpoint name="WsSecurity10_scenario_1" useWSA="true" useWSSec="true"
useWSRM="false" address="http://localhost:9090/ssj/pingservice/Ping1">
<parameter name="OutflowSecurity">
<action>
- <items>Timestamp</items>
+ <items>UsernameToken</items>
+ <user>Chris</user>
+
<passwordCallbackClass>samples.qos.security.WSSecInteropPWCallback</passwordCallbackClass>
+ <passwordType>PasswordText</passwordType>
+ </action>
+ </parameter>
+ </endpoint>
+
+ <endpoint name="WsSecurity10_scenario_3" useWSA="true" useWSSec="true"
useWSRM="false" address="http://localhost:9090/ssj/pingservice/Ping3">
+ <parameter name="OutflowSecurity">
+ <action>
+
+ <items>Timestamp Signature Encrypt</items>
+ <user>7dbc945b2ea9f2a8e5d163d80682a78fec42cbd0</user>
+
<passwordCallbackClass>samples.qos.security.WSSecInteropPWCallback</passwordCallbackClass>
+ <signaturePropFile>interop-client.properties</signaturePropFile>
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+
<encryptionKeyIdentifier>DirectReference</encryptionKeyIdentifier>
+
<encryptionPropFile>interop-server.properties</encryptionPropFile>
+
<encryptionUser>38f376d22dc95f6329e43a91c6e8bedc22d044ff</encryptionUser>
+
+ </action>
+ </parameter>
+
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Encrypt Signature Timestamp</items>
+
<passwordCallbackClass>samples.qos.security.WSSecInteropPWCallback</passwordCallbackClass>
+ <signaturePropFile>interop-client.properties</signaturePropFile>
+
<!--<decryptionPropFile>interop-server.properties</decryptionPropFile> -->
+
<!--<decryptionUser>38f376d22dc95f6329e43a91c6e8bedc22d044ff</decryptionUser>-->
</action>
</parameter>
</endpoint>
@@ -24,7 +47,23 @@
<send/>
</out>
<in>
- <sequence ref="stockquote"/>
+ <switch source="get-property('Action')">
+ <case regex="Ping1">
+ <header name="Action" value="http://xmlsoap.org/Ping"/>
+ <send>
+ <endpoint
ref="WsSecurity10_scenario_1"/>
+ </send>
+ </case>
+ <case regex="Ping3">
+ <header name="Action" value="http://xmlsoap.org/Ping"/>
+ <send>
+ <endpoint
ref="WsSecurity10_scenario_3"/>
+ </send>
+ </case>
+ <default>
+ <send/>
+ </default>
+ </switch>
</in>
</rules>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]