You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by as...@apache.org on 2006/10/04 19:33:49 UTC
svn commit: r452947 - in /incubator/synapse/trunk/java:
modules/samples/services/SecureStockQuoteService1/
modules/samples/services/SecureStockQuoteService1/conf/
modules/samples/services/SecureStockQuoteService1/src/
modules/samples/services/SecureSto...
Author: asankha
Date: Wed Oct 4 10:33:47 2006
New Revision: 452947
URL: http://svn.apache.org/viewvc?view=rev&rev=452947
Log:
Checkin samples for the new neethi/Policy framework with WS-Security
Added:
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/build.xml
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/conf/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/conf/services.xml
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/PWCallback.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/README.txt
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuote.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuoteResponse.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/PlaceOrder.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/SimpleStockQuoteService.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/store.jks (with props)
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/build.xml
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/conf/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/conf/services.xml
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/PWCallback.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/README.txt
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuote.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuoteResponse.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/PlaceOrder.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/SimpleStockQuoteService.java
incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/store.jks (with props)
incubator/synapse/trunk/java/repository/conf/sample/policy_1.xml
incubator/synapse/trunk/java/repository/conf/sample/policy_3.xml
incubator/synapse/trunk/java/repository/conf/sample/store.jks (with props)
incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml
Modified:
incubator/synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/build.xml
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/build.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/build.xml?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/build.xml (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/build.xml Wed Oct 4 10:33:47 2006
@@ -0,0 +1,52 @@
+<project default="build-service">
+
+ <property name="synapse.home" value="../../../"/>
+ <property name="lib" value="${synapse.home}/lib"/>
+ <property name="temp.dir" value="temp"/>
+ <property name="classes" value="${temp.dir}/classes"/>
+ <property name="src" value="src"/>
+ <property name="services" value="services"/>
+
+ <path id="synapse.class.path">
+ <pathelement path="${java.class.path}"/>
+ <fileset dir="${synapse.home}">
+ <include name="lib/*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="init" depends="clean">
+ <mkdir dir="${temp.dir}"/>
+ <mkdir dir="${classes}"/>
+ <mkdir dir="${services}"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="${temp.dir}"/>
+ </target>
+
+ <target name="compile-all" depends="init">
+ <javac debug="on" destdir="${classes}">
+ <src path="${src}"/>
+ <classpath refid="synapse.class.path"/>
+ </javac>
+ </target>
+
+ <target name="build-service" depends="compile-all">
+ <property name="SSQ.dir" value="${temp.dir}/SecureStockQuoteService1"/>
+ <mkdir dir="${SSQ.dir}"/>
+
+ <mkdir dir="${SSQ.dir}/META-INF"/>
+ <copy file="conf/services.xml" tofile="${SSQ.dir}/META-INF/services.xml"/>
+ <copy file="store.jks" tofile="${SSQ.dir}/store.jks"/>
+ <copy toDir="${SSQ.dir}">
+ <fileset dir="${classes}">
+ <include name="**/*.class"/>
+ </fileset>
+ </copy>
+
+ <jar destfile="${services}/SecureStockQuoteService1.aar">
+ <fileset dir="${SSQ.dir}"/>
+ </jar>
+ </target>
+
+</project>
\ No newline at end of file
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/conf/services.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/conf/services.xml?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/conf/services.xml (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/conf/services.xml Wed Oct 4 10:33:47 2006
@@ -0,0 +1,52 @@
+<serviceGroup>
+<service name="SecureStockQuoteService1">
+ <module ref="rampart"/>
+
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
+ </messageReceivers>
+ <parameter locked="false" name="ServiceClass">samples.services.SimpleStockQuoteService</parameter>
+
+ <wsp:Policy wsu:Id="UTOverTransport" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken RequireClientCertificate="false"/>
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+</service>
+</serviceGroup>
\ No newline at end of file
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/PWCallback.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/PWCallback.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/PWCallback.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/PWCallback.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,189 @@
+/*
+ * 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 org.apache.rampart;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import java.io.IOException;
+
+public class PWCallback 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,
+
+ };
+
+
+
+ /*
+
+ * (non-Javadoc)
+
+ * @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
+
+ */
+
+
+
+ /**
+
+ * 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.getIdentifer().equals("joe") && pc.getPassword().equals("eoj")) {
+
+ 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("joe")) {
+
+ pc.setPassword("eoj");
+
+ } else if(pc.getIdentifer().equals("ip")) {
+
+ pc.setPassword("password");
+
+ } else {
+
+ pc.setPassword("sirhC");
+
+ }
+
+ } else {
+
+ throw new UnsupportedCallbackException(callbacks[i],
+
+ "Unrecognized Callback");
+
+ }
+
+ }
+
+ }
+
+}
\ No newline at end of file
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/README.txt
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/README.txt?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/README.txt (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/org/apache/rampart/README.txt Wed Oct 4 10:33:47 2006
@@ -0,0 +1 @@
+The original file is in the SVN under Axis2/modules/integration/test
\ No newline at end of file
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuote.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuote.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuote.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuote.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,35 @@
+/*
+* 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.services;
+
+public class GetQuote {
+ String symbol;
+
+ public GetQuote() {
+ }
+
+ public GetQuote(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+}
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuoteResponse.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuoteResponse.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuoteResponse.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/GetQuoteResponse.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,174 @@
+/*
+* 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.services;
+
+import java.util.Date;
+
+public class GetQuoteResponse {
+ String symbol;
+ double last;
+ String lastTradeTimestamp;
+ double change;
+ double open;
+ double high;
+ double low;
+ int volume;
+ double marketCap;
+ double prevClose;
+ double percentageChange;
+ double earnings;
+ double peRatio;
+ String name;
+
+ public GetQuoteResponse() {
+ }
+
+ public GetQuoteResponse(String symbol) {
+ this.symbol = symbol;
+ this.last = getRandom(100, 0.9, true);
+ this.lastTradeTimestamp = new Date().toString();
+ this.change = getRandom(3, 0.5, false);
+ this.open = getRandom(last, 0.05, false);
+ this.high = getRandom(last, 0.05, false);
+ this.low = getRandom(last, 0.05, false);
+ this.volume = (int) getRandom(10000, 1.0, true);
+ this.marketCap = getRandom(10E6, 5.0, false);
+ this.prevClose = getRandom(last, 0.15, false);
+ this.percentageChange = change / prevClose * 100;
+ this.earnings = getRandom(10, 0.4, false);
+ this.peRatio = getRandom(20, 0.30, false);
+ this.name = symbol + " Company";
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public double getLast() {
+ return last;
+ }
+
+ public void setLast(double last) {
+ this.last = last;
+ }
+
+ public String getLastTradeTimestamp() {
+ return lastTradeTimestamp;
+ }
+
+ public void setLastTradeTimestamp(String lastTradeTimestamp) {
+ this.lastTradeTimestamp = lastTradeTimestamp;
+ }
+
+ public double getChange() {
+ return change;
+ }
+
+ public void setChange(double change) {
+ this.change = change;
+ }
+
+ public double getOpen() {
+ return open;
+ }
+
+ public void setOpen(double open) {
+ this.open = open;
+ }
+
+ public double getHigh() {
+ return high;
+ }
+
+ public void setHigh(double high) {
+ this.high = high;
+ }
+
+ public double getLow() {
+ return low;
+ }
+
+ public void setLow(double low) {
+ this.low = low;
+ }
+
+ public int getVolume() {
+ return volume;
+ }
+
+ public void setVolume(int volume) {
+ this.volume = volume;
+ }
+
+ public double getMarketCap() {
+ return marketCap;
+ }
+
+ public void setMarketCap(double marketCap) {
+ this.marketCap = marketCap;
+ }
+
+ public double getPrevClose() {
+ return prevClose;
+ }
+
+ public void setPrevClose(double prevClose) {
+ this.prevClose = prevClose;
+ }
+
+ public double getPercentageChange() {
+ return percentageChange;
+ }
+
+ public void setPercentageChange(double percentageChange) {
+ this.percentageChange = percentageChange;
+ }
+
+ public double getEarnings() {
+ return earnings;
+ }
+
+ public void setEarnings(double earnings) {
+ this.earnings = earnings;
+ }
+
+ public double getPeRatio() {
+ return peRatio;
+ }
+
+ public void setPeRatio(double peRatio) {
+ this.peRatio = peRatio;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ private static double getRandom(double base, double varience, boolean onlypositive) {
+ double rand = Math.random();
+ return (base + ((rand > 0.5 ? 1 : -1) * varience * base * rand))
+ * (onlypositive ? 1 : (rand > 0.5 ? 1 : -1));
+ }
+
+}
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/PlaceOrder.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/PlaceOrder.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/PlaceOrder.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/PlaceOrder.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,46 @@
+/*
+* 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.services;
+
+public class PlaceOrder {
+ String symbol;
+ int quantity;
+ double price;
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public double getPrice() {
+ return price;
+ }
+
+ public void setPrice(double price) {
+ this.price = price;
+ }
+}
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/SimpleStockQuoteService.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/SimpleStockQuoteService.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/SimpleStockQuoteService.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/src/samples/services/SimpleStockQuoteService.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,33 @@
+/*
+* 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.services;
+import java.util.Date;
+
+public class SimpleStockQuoteService {
+
+ // in-out
+ public GetQuoteResponse getQuote(GetQuote request) {
+ System.out.println(new Date() + " :: Generating quote for : " + request.getSymbol());
+ return new GetQuoteResponse(request.getSymbol());
+ }
+
+ // in only
+ public void placeOrder(PlaceOrder order) {
+ System.out.println(new Date() + " :: Accepted order for : " +
+ order.getQuantity() + " stocks of " + order.getSymbol() +
+ " at $ " + order.getPrice());
+ }
+}
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/store.jks
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/store.jks?view=auto&rev=452947
==============================================================================
Binary file - no diff available.
Propchange: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService1/store.jks
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/build.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/build.xml?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/build.xml (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/build.xml Wed Oct 4 10:33:47 2006
@@ -0,0 +1,52 @@
+<project default="build-service">
+
+ <property name="synapse.home" value="../../../"/>
+ <property name="lib" value="${synapse.home}/lib"/>
+ <property name="temp.dir" value="temp"/>
+ <property name="classes" value="${temp.dir}/classes"/>
+ <property name="src" value="src"/>
+ <property name="services" value="services"/>
+
+ <path id="synapse.class.path">
+ <pathelement path="${java.class.path}"/>
+ <fileset dir="${synapse.home}">
+ <include name="lib/*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="init" depends="clean">
+ <mkdir dir="${temp.dir}"/>
+ <mkdir dir="${classes}"/>
+ <mkdir dir="${services}"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="${temp.dir}"/>
+ </target>
+
+ <target name="compile-all" depends="init">
+ <javac debug="on" destdir="${classes}">
+ <src path="${src}"/>
+ <classpath refid="synapse.class.path"/>
+ </javac>
+ </target>
+
+ <target name="build-service" depends="compile-all">
+ <property name="SSQ.dir" value="${temp.dir}/SecureStockQuoteService3"/>
+ <mkdir dir="${SSQ.dir}"/>
+
+ <mkdir dir="${SSQ.dir}/META-INF"/>
+ <copy file="conf/services.xml" tofile="${SSQ.dir}/META-INF/services.xml"/>
+ <copy file="store.jks" tofile="${SSQ.dir}/store.jks"/>
+ <copy toDir="${SSQ.dir}">
+ <fileset dir="${classes}">
+ <include name="**/*.class"/>
+ </fileset>
+ </copy>
+
+ <jar destfile="${services}/SecureStockQuoteService3.aar">
+ <fileset dir="${SSQ.dir}"/>
+ </jar>
+ </target>
+
+</project>
\ No newline at end of file
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/conf/services.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/conf/services.xml?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/conf/services.xml (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/conf/services.xml Wed Oct 4 10:33:47 2006
@@ -0,0 +1,89 @@
+<serviceGroup>
+<service name="SecureStockQuoteService3">
+ <module ref="rampart"/>
+
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
+ </messageReceivers>
+ <parameter locked="false" name="ServiceClass">samples.services.SimpleStockQuoteService</parameter>
+
+ <wsp:Policy wsu:Id="SigEncr" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+</service>
+</serviceGroup>
\ No newline at end of file
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/PWCallback.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/PWCallback.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/PWCallback.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/PWCallback.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,189 @@
+/*
+ * 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 org.apache.rampart;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import java.io.IOException;
+
+public class PWCallback 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,
+
+ };
+
+
+
+ /*
+
+ * (non-Javadoc)
+
+ * @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
+
+ */
+
+
+
+ /**
+
+ * 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.getIdentifer().equals("joe") && pc.getPassword().equals("eoj")) {
+
+ 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("joe")) {
+
+ pc.setPassword("eoj");
+
+ } else if(pc.getIdentifer().equals("ip")) {
+
+ pc.setPassword("password");
+
+ } else {
+
+ pc.setPassword("sirhC");
+
+ }
+
+ } else {
+
+ throw new UnsupportedCallbackException(callbacks[i],
+
+ "Unrecognized Callback");
+
+ }
+
+ }
+
+ }
+
+}
\ No newline at end of file
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/README.txt
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/README.txt?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/README.txt (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/org/apache/rampart/README.txt Wed Oct 4 10:33:47 2006
@@ -0,0 +1 @@
+The original file is in the SVN under Axis2/modules/integration/test
\ No newline at end of file
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuote.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuote.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuote.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuote.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,35 @@
+/*
+* 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.services;
+
+public class GetQuote {
+ String symbol;
+
+ public GetQuote() {
+ }
+
+ public GetQuote(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+}
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuoteResponse.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuoteResponse.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuoteResponse.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/GetQuoteResponse.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,174 @@
+/*
+* 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.services;
+
+import java.util.Date;
+
+public class GetQuoteResponse {
+ String symbol;
+ double last;
+ String lastTradeTimestamp;
+ double change;
+ double open;
+ double high;
+ double low;
+ int volume;
+ double marketCap;
+ double prevClose;
+ double percentageChange;
+ double earnings;
+ double peRatio;
+ String name;
+
+ public GetQuoteResponse() {
+ }
+
+ public GetQuoteResponse(String symbol) {
+ this.symbol = symbol;
+ this.last = getRandom(100, 0.9, true);
+ this.lastTradeTimestamp = new Date().toString();
+ this.change = getRandom(3, 0.5, false);
+ this.open = getRandom(last, 0.05, false);
+ this.high = getRandom(last, 0.05, false);
+ this.low = getRandom(last, 0.05, false);
+ this.volume = (int) getRandom(10000, 1.0, true);
+ this.marketCap = getRandom(10E6, 5.0, false);
+ this.prevClose = getRandom(last, 0.15, false);
+ this.percentageChange = change / prevClose * 100;
+ this.earnings = getRandom(10, 0.4, false);
+ this.peRatio = getRandom(20, 0.30, false);
+ this.name = symbol + " Company";
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public double getLast() {
+ return last;
+ }
+
+ public void setLast(double last) {
+ this.last = last;
+ }
+
+ public String getLastTradeTimestamp() {
+ return lastTradeTimestamp;
+ }
+
+ public void setLastTradeTimestamp(String lastTradeTimestamp) {
+ this.lastTradeTimestamp = lastTradeTimestamp;
+ }
+
+ public double getChange() {
+ return change;
+ }
+
+ public void setChange(double change) {
+ this.change = change;
+ }
+
+ public double getOpen() {
+ return open;
+ }
+
+ public void setOpen(double open) {
+ this.open = open;
+ }
+
+ public double getHigh() {
+ return high;
+ }
+
+ public void setHigh(double high) {
+ this.high = high;
+ }
+
+ public double getLow() {
+ return low;
+ }
+
+ public void setLow(double low) {
+ this.low = low;
+ }
+
+ public int getVolume() {
+ return volume;
+ }
+
+ public void setVolume(int volume) {
+ this.volume = volume;
+ }
+
+ public double getMarketCap() {
+ return marketCap;
+ }
+
+ public void setMarketCap(double marketCap) {
+ this.marketCap = marketCap;
+ }
+
+ public double getPrevClose() {
+ return prevClose;
+ }
+
+ public void setPrevClose(double prevClose) {
+ this.prevClose = prevClose;
+ }
+
+ public double getPercentageChange() {
+ return percentageChange;
+ }
+
+ public void setPercentageChange(double percentageChange) {
+ this.percentageChange = percentageChange;
+ }
+
+ public double getEarnings() {
+ return earnings;
+ }
+
+ public void setEarnings(double earnings) {
+ this.earnings = earnings;
+ }
+
+ public double getPeRatio() {
+ return peRatio;
+ }
+
+ public void setPeRatio(double peRatio) {
+ this.peRatio = peRatio;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ private static double getRandom(double base, double varience, boolean onlypositive) {
+ double rand = Math.random();
+ return (base + ((rand > 0.5 ? 1 : -1) * varience * base * rand))
+ * (onlypositive ? 1 : (rand > 0.5 ? 1 : -1));
+ }
+
+}
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/PlaceOrder.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/PlaceOrder.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/PlaceOrder.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/PlaceOrder.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,46 @@
+/*
+* 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.services;
+
+public class PlaceOrder {
+ String symbol;
+ int quantity;
+ double price;
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public double getPrice() {
+ return price;
+ }
+
+ public void setPrice(double price) {
+ this.price = price;
+ }
+}
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/SimpleStockQuoteService.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/SimpleStockQuoteService.java?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/SimpleStockQuoteService.java (added)
+++ incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/src/samples/services/SimpleStockQuoteService.java Wed Oct 4 10:33:47 2006
@@ -0,0 +1,33 @@
+/*
+* 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.services;
+import java.util.Date;
+
+public class SimpleStockQuoteService {
+
+ // in-out
+ public GetQuoteResponse getQuote(GetQuote request) {
+ System.out.println(new Date() + " :: Generating quote for : " + request.getSymbol());
+ return new GetQuoteResponse(request.getSymbol());
+ }
+
+ // in only
+ public void placeOrder(PlaceOrder order) {
+ System.out.println(new Date() + " :: Accepted order for : " +
+ order.getQuantity() + " stocks of " + order.getSymbol() +
+ " at $ " + order.getPrice());
+ }
+}
Added: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/store.jks
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/store.jks?view=auto&rev=452947
==============================================================================
Binary file - no diff available.
Propchange: incubator/synapse/trunk/java/modules/samples/services/SecureStockQuoteService3/store.jks
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: incubator/synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/build.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/build.xml?view=diff&rev=452947&r1=452946&r2=452947
==============================================================================
--- incubator/synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/build.xml (original)
+++ incubator/synapse/trunk/java/modules/samples/services/SimpleStockQuoteService/build.xml Wed Oct 4 10:33:47 2006
@@ -1,6 +1,6 @@
<project default="build-service">
- <property name="synapse.home" value="../../"/>
+ <property name="synapse.home" value="../../../"/>
<property name="lib" value="${synapse.home}/lib"/>
<property name="temp.dir" value="temp"/>
<property name="classes" value="${temp.dir}/classes"/>
Added: incubator/synapse/trunk/java/repository/conf/sample/policy_1.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/policy_1.xml?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/repository/conf/sample/policy_1.xml (added)
+++ incubator/synapse/trunk/java/repository/conf/sample/policy_1.xml Wed Oct 4 10:33:47 2006
@@ -0,0 +1,52 @@
+<wsp:Policy wsu:Id="UTOverTransport" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+<wsp:ExactlyOne>
+ <wsp:All>
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken RequireClientCertificate="false"/>
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">synapse_repository/conf/store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">synapse_repository/conf/store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+</wsp:ExactlyOne>
+</wsp:Policy>
Added: incubator/synapse/trunk/java/repository/conf/sample/policy_3.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/policy_3.xml?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/repository/conf/sample/policy_3.xml (added)
+++ incubator/synapse/trunk/java/repository/conf/sample/policy_3.xml Wed Oct 4 10:33:47 2006
@@ -0,0 +1,72 @@
+<wsp:Policy wsu:Id="SigEncr" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">synapse_repository/conf/store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">synapse_repository/conf/store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
\ No newline at end of file
Added: incubator/synapse/trunk/java/repository/conf/sample/store.jks
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/store.jks?view=auto&rev=452947
==============================================================================
Binary file - no diff available.
Propchange: incubator/synapse/trunk/java/repository/conf/sample/store.jks
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml?view=auto&rev=452947
==============================================================================
--- incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml (added)
+++ incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml Wed Oct 4 10:33:47 2006
@@ -0,0 +1,35 @@
+<synapse xmlns="http://ws.apache.org/ns/synapse">
+
+ <definitions>
+
+ <set-property name="policy_1" src="file:synapse_repository/conf/policy_1.xml"/>
+ <set-property name="policy_3" src="file:synapse_repository/conf/policy_3.xml"/>
+
+ <endpoint name="secureEndpoint1" address="http://localhost:9001/axis2/services/SecureStockQuoteService1">
+ <enableSec policy="policy_1"/>
+ </endpoint>
+
+ <endpoint name="secureEndpoint3" address="http://localhost:9001/axis2/services/SecureStockQuoteService3">
+ <enableSec policy="policy_3"/>
+ </endpoint>
+
+ </definitions>
+
+ <rules>
+ <filter source="get-property('To')" regex=".*/SecureStockQuoteService1.*">
+ <send>
+ <endpoint ref="secureEndpoint1"/>
+ </send>
+ <drop/>
+ </filter>
+
+ <filter source="get-property('To')" regex=".*/SecureStockQuoteService3.*">
+ <send>
+ <endpoint ref="secureEndpoint3"/>
+ </send>
+ <drop/>
+ </filter>
+ <send/>
+ </rules>
+
+</synapse>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org