You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/01/29 21:41:44 UTC
svn commit: r1780860 - in
/axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy:
./ sample09/ sample09/src/ sample09/src/org/ sample09/src/org/apache/
sample09/src/org/apache/rampart/ sample09/src/org/apache/rampart/samples/
samp...
Author: veithen
Date: Sun Jan 29 21:41:43 2017
New Revision: 1780860
URL: http://svn.apache.org/viewvc?rev=1780860&view=rev
Log:
RAMPART-339: Apply patch provided by Hasini Gunasinghe.
Added:
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/README.txt (with props)
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_in_policy.xml (with props)
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_out_policy.xml (with props)
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/services.xml (with props)
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/Client.java (with props)
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/PWCBHandler.java (with props)
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/SimpleService.java (with props)
Modified:
axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/build.xml
Modified: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/build.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/build.xml?rev=1780860&r1=1780859&r2=1780860&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/build.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/build.xml Sun Jan 29 21:41:43 2017
@@ -134,6 +134,14 @@
dest="${endorsed.dir}/xercesImpl-2.9.1.jar" verbose="true"/>
</target>
+ <!--Sample Service 09-->
+ <target name="service.09" if="env.AXIS2_HOME" depends="check.dependency">
+ <create.service.repo sample.number="09"/>
+ </target>
+ <!--Sample Client 09-->
+ <target name="client.09" if="env.AXIS2_HOME" depends="check.dependency">
+ <create.and.run.client sample.number="09"/>
+ </target>
<target name="clean">
<delete dir="${build.dir}" />
Added: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/README.txt
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/README.txt?rev=1780860&view=auto
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/README.txt (added)
+++ axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/README.txt Sun Jan 29 21:41:43 2017
@@ -0,0 +1,4 @@
+Different security policies to secure request and response messages.
+
+1. Request message is secured with encrypt only policy with symmetric binding.
+2. Response message is secured with sign only policy with symmetric binding.
\ No newline at end of file
Propchange: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_in_policy.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_in_policy.xml?rev=1780860&view=auto
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_in_policy.xml (added)
+++ axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_in_policy.xml Sun Jan 29 21:41:43 2017
@@ -0,0 +1,70 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ wsu:Id="SignOnly">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireThumbprintReference/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ <sp:MustSupportRefThumbprint/>
+ <sp:RequireSignatureConfirmation/>
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ <sp:MustSupportIssuedTokens/>
+ </wsp:Policy>
+ </sp:Trust10>
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>client</ramp:user>
+ <ramp:encryptionUser>service</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.samples.policy.sample09.PWCBHandler
+ </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">client.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">apache
+ </ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
Propchange: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_in_policy.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_out_policy.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_out_policy.xml?rev=1780860&view=auto
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_out_policy.xml (added)
+++ axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_out_policy.xml Sun Jan 29 21:41:43 2017
@@ -0,0 +1,79 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ wsu:Id="EncryptOnly">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireThumbprintReference/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:EncryptedParts
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ <sp:MustSupportRefThumbprint/>
+ <sp:RequireSignatureConfirmation/>
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ <sp:MustSupportIssuedTokens/>
+ </wsp:Policy>
+ </sp:Trust10>
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>client</ramp:user>
+ <ramp:encryptionUser>service</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.samples.policy.sample09.PWCBHandler
+ </ramp:passwordCallbackClass>
+
+ <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">client.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">apache
+ </ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ <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">client.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">apache
+ </ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
Propchange: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/client_out_policy.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/services.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/services.xml?rev=1780860&view=auto
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/services.xml (added)
+++ axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/services.xml Sun Jan 29 21:41:43 2017
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ !
+ ! Copyright 2006 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.
+ !-->
+<!-- services.xml for sample09 with different in,out policies -->
+<service>
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
+ </operation>
+ <parameter name="ServiceClass" locked="false">org.apache.rampart.samples.policy.sample09.SimpleService</parameter>
+
+ <module ref="rampart"/>
+ <module ref="addressing"/>
+
+ <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:AppliesTo>
+ <policy-subject identifier="binding:soap11/operation:echo/in"/>
+ <policy-subject identifier="binding:soap12/operation:echo/in"/>
+ </wsp:AppliesTo>
+ <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ wsu:Id="EncryptOnly">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireThumbprintReference/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ <sp:MustSupportRefThumbprint/>
+ <sp:RequireSignatureConfirmation/>
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ <sp:MustSupportIssuedTokens/>
+ </wsp:Policy>
+ </sp:Trust10>
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>service</ramp:user>
+ <ramp:encryptionUser>service</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.samples.policy.sample09.PWCBHandler
+ </ramp:passwordCallbackClass>
+
+ <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">service.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">apache
+ </ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ <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">service.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">apache
+ </ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:AppliesTo>
+ <policy-subject identifier="binding:soap11/operation:echo/out"/>
+ <policy-subject identifier="binding:soap12/operation:echo/out"/>
+ </wsp:AppliesTo>
+ <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ wsu:Id="SignOnly">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireThumbprintReference/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ <sp:MustSupportRefThumbprint/>
+ <sp:RequireSignatureConfirmation/>
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ <sp:MustSupportIssuedTokens/>
+ </wsp:Policy>
+ </sp:Trust10>
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>service</ramp:user>
+ <ramp:encryptionUser>service</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.samples.policy.sample09.PWCBHandler
+ </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">service.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">apache
+ </ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+ </wsp:PolicyAttachment>
+
+</service>
\ No newline at end of file
Propchange: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/services.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/Client.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/Client.java?rev=1780860&view=auto
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/Client.java (added)
+++ axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/Client.java Sun Jan 29 21:41:43 2017
@@ -0,0 +1,80 @@
+/*
+ * 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.samples.policy.sample09;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyEngine;
+import org.apache.rampart.RampartMessageData;
+
+import javax.xml.namespace.QName;
+
+public class Client {
+
+ public static void main(String[] args) throws Exception {
+
+ if(args.length != 3) {
+ System.out.println("Usage: $java Client endpoint_address client_repo_path policy_xml_path");
+ }
+
+ ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(args[1], null);
+
+ ServiceClient client = new ServiceClient(ctx, null);
+ Options options = new Options();
+ options.setAction("urn:echo");
+ options.setTo(new EndpointReference(args[0]));
+ //load and attach in/out sec policies
+ String policyPath= args[2].split("/")[0];
+ options.setProperty(RampartMessageData.KEY_RAMPART_IN_POLICY, loadPolicy(policyPath + "/client_in_policy.xml"));
+ options.setProperty(RampartMessageData.KEY_RAMPART_OUT_POLICY, loadPolicy(policyPath + "/client_out_policy.xml"));
+ client.setOptions(options);
+
+ client.engageModule("addressing");
+ client.engageModule("rampart");
+
+ OMElement response = client.sendReceive(getPayload("Hello world"));
+
+ System.out.println(response);
+
+ }
+
+ private static Policy loadPolicy(String xmlPath) throws Exception {
+ StAXOMBuilder builder = new StAXOMBuilder(xmlPath);
+ return PolicyEngine.getPolicy(builder.getDocumentElement());
+ }
+
+ private static OMElement getPayload(String value) {
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMNamespace ns = factory.createOMNamespace("http://sample09.policy.samples.rampart.apache.org","ns1");
+ OMElement elem = factory.createOMElement("echo", ns);
+ OMElement childElem = factory.createOMElement("param0", ns);
+ childElem.setText(value);
+ elem.addChild(childElem);
+
+ return elem;
+ }
+
+}
Propchange: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/Client.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/PWCBHandler.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/PWCBHandler.java?rev=1780860&view=auto
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/PWCBHandler.java (added)
+++ axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/PWCBHandler.java Sun Jan 29 21:41:43 2017
@@ -0,0 +1,42 @@
+/*
+ * 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.samples.policy.sample09;
+
+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 PWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ String id = pwcb.getIdentifer();
+ if("client".equals(id)) {
+ pwcb.setPassword("apache");
+ } else if("service".equals(id)) {
+ pwcb.setPassword("apache");
+ }
+ }
+ }
+
+}
Propchange: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/PWCBHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/SimpleService.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/SimpleService.java?rev=1780860&view=auto
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/SimpleService.java (added)
+++ axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/SimpleService.java Sun Jan 29 21:41:43 2017
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2003-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.samples.policy.sample09;
+public class SimpleService {
+
+ public String echo(String arg) {
+ return arg;
+ }
+}
Propchange: axis/axis2/java/rampart/branches/RAMPART-339/modules/rampart-samples/policy/sample09/src/org/apache/rampart/samples/policy/sample09/SimpleService.java
------------------------------------------------------------------------------
svn:eol-style = native