servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r430086 - in /incubator/servicemix/trunk/samples/ws-sec: ./ src/ src/main/ src/main/assembly/ src/main/resources/
Date Wed, 09 Aug 2006 16:29:41 GMT
Author: gnodet
Date: Wed Aug  9 09:29:38 2006
New Revision: 430086

URL: http://svn.apache.org/viewvc?rev=430086&view=rev
Log:
Add a ws-security example

Added:
    incubator/servicemix/trunk/samples/ws-sec/   (with props)
    incubator/servicemix/trunk/samples/ws-sec/client-basic.html
    incubator/servicemix/trunk/samples/ws-sec/client-ws-sec.html
    incubator/servicemix/trunk/samples/ws-sec/pom.xml
    incubator/servicemix/trunk/samples/ws-sec/src/
    incubator/servicemix/trunk/samples/ws-sec/src/main/
    incubator/servicemix/trunk/samples/ws-sec/src/main/assembly/
    incubator/servicemix/trunk/samples/ws-sec/src/main/assembly/src.xml
    incubator/servicemix/trunk/samples/ws-sec/src/main/resources/
    incubator/servicemix/trunk/samples/ws-sec/src/main/resources/groups.properties
    incubator/servicemix/trunk/samples/ws-sec/src/main/resources/login.properties
    incubator/servicemix/trunk/samples/ws-sec/src/main/resources/servicemix.xml
    incubator/servicemix/trunk/samples/ws-sec/src/main/resources/users.properties

Propchange: incubator/servicemix/trunk/samples/ws-sec/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug  9 09:29:38 2006
@@ -0,0 +1 @@
+target

Added: incubator/servicemix/trunk/samples/ws-sec/client-basic.html
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/ws-sec/client-basic.html?rev=430086&view=auto
==============================================================================
--- incubator/servicemix/trunk/samples/ws-sec/client-basic.html (added)
+++ incubator/servicemix/trunk/samples/ws-sec/client-basic.html Wed Aug  9 09:29:38 2006
@@ -0,0 +1,102 @@
+<html>
+<head>
+<title>ServiceMix SOAP Binding Example</title>
+<script type="text/javascript">
+
+function getHTTPObject() {
+  var xmlhttp = false;
+
+  /* Compilation conditionnelle d'IE */
+  /*@cc_on
+  @if (@_jscript_version >= 5)
+     try {
+        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+     } catch (e) {
+        try {
+           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+        } catch (E) {
+           xmlhttp = false;
+        }
+     }
+  @else
+     xmlhttp = false;
+  @end @*/
+
+  /* on essaie de créer l'objet si ce n'est pas déjà fait */
+  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
+     try {
+        xmlhttp = new XMLHttpRequest();
+     } catch (e) {
+        xmlhttp = false;
+     }
+  }
+
+  if (xmlhttp) {
+     /* on définit ce qui doit se passer quand la page répondra */
+     xmlhttp.onreadystatechange=function() {
+        if (xmlhttp.readyState == 4) { /* 4 : état "complete" */
+           var response = document.getElementById("response");
+           response.value = "STATUS: " + xmlhttp.status + "\n" + xmlhttp.responseText
+        }
+     }
+  }
+  return xmlhttp;
+}
+
+function send() {
+  var xmlhttp = getHTTPObject();
+  if (!xmlhttp) {
+    alert('cound not create XMLHttpRequest object');
+    return;
+  }
+  var request = document.getElementById("request");
+  var response = document.getElementById("response");
+  try {
+    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead UniversalBrowserWrite");
+    xmlhttp.open("POST", "http://localhost:8192/Service/", true);
+  } catch (e) {
+    alert('error opening');
+  }
+  xmlhttp.send(request.value);
+}
+
+</script>
+</head>
+
+<body>
+
+<h1>ServiceMix SOAP Binding Example</h1>
+
+<p>Welcome to the soap binding example for ServiceMix</p>
+
+Perform a POST into the HTTP binding <p>
+
+<table>
+  <tr>
+    <td>
+  <textarea id="request" style="width:600px;height:400px" onKeyUp="send();"><?xml
version="1.0" encoding="UTF-8"?>
+<e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/">
+  <e:Body>
+    <ping>
+      <pingRequest>
+        <message xmlns="http://soap">hel lo</message>
+      </pingRequest>
+    </ping>
+  </e:Body>
+</e:Envelope>
+
+  </textarea>
+    </td>
+    <td>
+  <textarea id="response" style="width:600px;height:400px">
+  </textarea>
+    </td>
+  </tr>
+  <tr>
+    <td colspan=2>
+  <input type="button" value="Send" onClick="send();"/>
+    </td>
+  </tr>
+</table>
+</body>
+</html>

Added: incubator/servicemix/trunk/samples/ws-sec/client-ws-sec.html
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/ws-sec/client-ws-sec.html?rev=430086&view=auto
==============================================================================
--- incubator/servicemix/trunk/samples/ws-sec/client-ws-sec.html (added)
+++ incubator/servicemix/trunk/samples/ws-sec/client-ws-sec.html Wed Aug  9 09:29:38 2006
@@ -0,0 +1,106 @@
+<html>
+<head>
+<title>ServiceMix SOAP Binding Example</title>
+<script type="text/javascript">
+
+function getHTTPObject() {
+  var xmlhttp = false;
+
+  /* Compilation conditionnelle d'IE */
+  /*@cc_on
+  @if (@_jscript_version >= 5)
+     try {
+        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+     } catch (e) {
+        try {
+           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+        } catch (E) {
+           xmlhttp = false;
+        }
+     }
+  @else
+     xmlhttp = false;
+  @end @*/
+
+  /* on essaie de créer l'objet si ce n'est pas déjà fait */
+  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
+     try {
+        xmlhttp = new XMLHttpRequest();
+     } catch (e) {
+        xmlhttp = false;
+     }
+  }
+
+  if (xmlhttp) {
+     /* on définit ce qui doit se passer quand la page répondra */
+     xmlhttp.onreadystatechange=function() {
+        if (xmlhttp.readyState == 4) { /* 4 : état "complete" */
+           var response = document.getElementById("response");
+           response.value = "STATUS: " + xmlhttp.status + "\n" + xmlhttp.responseText
+        }
+     }
+  }
+  return xmlhttp;
+}
+
+function send() {
+  var xmlhttp = getHTTPObject();
+  if (!xmlhttp) {
+    alert('cound not create XMLHttpRequest object');
+    return;
+  }
+  var request = document.getElementById("request");
+  var response = document.getElementById("response");
+  try {
+    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead UniversalBrowserWrite");
+    xmlhttp.open("POST", "http://localhost:8192/WSSec/", true);
+  } catch (e) {
+    alert('error opening');
+  }
+  xmlhttp.send(request.value);
+}
+
+</script>
+</head>
+
+<body>
+
+<h1>ServiceMix SOAP Binding Example</h1>
+
+<p>Welcome to the soap binding example for ServiceMix</p>
+
+Perform a POST into the HTTP binding <p>
+
+<table>
+  <tr>
+    <td>
+  <textarea id="request" style="width:600px;height:400px" onKeyUp="send();"><?xml
version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+               xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
+  <soap:Header>
+    <wsse:Security soap:mustUnderstand="1">
+      <wsse:UsernameToken>
+        <wsse:Username>user1</wsse:Username>
+        <wsse:Password>user1</wsse:Password>
+      </wsse:UsernameToken>
+    </wsse:Security>
+  </soap:Header>
+  <soap:Body>
+    <hello>world</hello>
+  </soap:Body>
+</soap:Envelope>
+
+  </textarea>
+    </td>
+    <td>
+  <textarea id="response" style="width:600px;height:400px">
+  </textarea>
+    </td>
+  </tr>
+  <tr>
+    <td colspan=2>
+  <input type="button" value="Send" onClick="send();"/>
+    </td>
+  </tr>
+</table>
+</body>
+</html>

Added: incubator/servicemix/trunk/samples/ws-sec/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/ws-sec/pom.xml?rev=430086&view=auto
==============================================================================
--- incubator/servicemix/trunk/samples/ws-sec/pom.xml (added)
+++ incubator/servicemix/trunk/samples/ws-sec/pom.xml Wed Aug  9 09:29:38 2006
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You 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.
+-->
+<!-- $Rev: 356052 $ $Date: 2005-12-11 14:41:20 -0800 (dim., 11 déc. 2005) $ -->
+<project
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns="http://maven.apache.org/POM/4.0.0">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix</groupId>
+        <artifactId>samples</artifactId>
+        <version>3.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.samples</groupId>
+    <artifactId>ws-sec</artifactId>
+    <name>ServiceMix :: Samples :: WS-Sec</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix</groupId>
+            <artifactId>servicemix-http</artifactId>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-servlet_2.4_spec</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.servicemix.tooling</groupId>
+                <artifactId>jbi-maven-plugin</artifactId>
+                <extensions>true</extensions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.1</version>
+                <inherited>false</inherited>
+                <executions>
+                    <execution>
+                        <id>src</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/src.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: incubator/servicemix/trunk/samples/ws-sec/src/main/assembly/src.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/ws-sec/src/main/assembly/src.xml?rev=430086&view=auto
==============================================================================
--- incubator/servicemix/trunk/samples/ws-sec/src/main/assembly/src.xml (added)
+++ incubator/servicemix/trunk/samples/ws-sec/src/main/assembly/src.xml Wed Aug  9 09:29:38
2006
@@ -0,0 +1,20 @@
+<assembly>
+  <id>src</id>
+  <formats>
+    <format>tar.gz</format>
+    <format>zip</format>
+  </formats>
+  <fileSets>
+    <fileSet>
+      <includes>
+        <include>README*</include>
+        <include>LICENSE*</include>
+        <include>NOTICE*</include>
+        <include>pom.xml</include>
+        <include>src/**/*</include>
+        <include>*/pom.xml</include>
+        <include>*/src/**/*</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</assembly>

Added: incubator/servicemix/trunk/samples/ws-sec/src/main/resources/groups.properties
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/ws-sec/src/main/resources/groups.properties?rev=430086&view=auto
==============================================================================
--- incubator/servicemix/trunk/samples/ws-sec/src/main/resources/groups.properties (added)
+++ incubator/servicemix/trunk/samples/ws-sec/src/main/resources/groups.properties Wed Aug
 9 09:29:38 2006
@@ -0,0 +1,2 @@
+admin=manager
+secure=user1

Added: incubator/servicemix/trunk/samples/ws-sec/src/main/resources/login.properties
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/ws-sec/src/main/resources/login.properties?rev=430086&view=auto
==============================================================================
--- incubator/servicemix/trunk/samples/ws-sec/src/main/resources/login.properties (added)
+++ incubator/servicemix/trunk/samples/ws-sec/src/main/resources/login.properties Wed Aug
 9 09:29:38 2006
@@ -0,0 +1,6 @@
+servicemix-domain {
+    org.apache.servicemix.jbi.security.login.PropertiesLoginModule required
+        debug=true
+        org.apache.servicemix.security.properties.user="users.properties"
+        org.apache.servicemix.security.properties.group="groups.properties";
+};

Added: incubator/servicemix/trunk/samples/ws-sec/src/main/resources/servicemix.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/ws-sec/src/main/resources/servicemix.xml?rev=430086&view=auto
==============================================================================
--- incubator/servicemix/trunk/samples/ws-sec/src/main/resources/servicemix.xml (added)
+++ incubator/servicemix/trunk/samples/ws-sec/src/main/resources/servicemix.xml Wed Aug  9
09:29:38 2006
@@ -0,0 +1,87 @@
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
+       xmlns:http="http://servicemix.apache.org/http/1.0"
+       xmlns:soap="http://servicemix.apache.org/soap/1.0"
+       xmlns:ex="http://servicemix.org/example">
+
+  <sm:systemProperties>
+    <property name="properties">
+      <map>
+        <entry key="java.security.auth.login.config">
+          <bean class="org.springframework.util.ResourceUtils" factory-method="getFile">
+            <constructor-arg value="classpath:login.properties"/>
+          </bean>
+        </entry>
+      </map>
+    </property>
+  </sm:systemProperties>
+
+  <sm:container id="jbi" rootDir="./target/data/smx">
+  
+    <!-- Use a secured broker which will check the authenticated
+         user for the needed ACLs before granting access to a given
+         endpoint -->
+    <sm:broker>
+      <sm:securedBroker>
+        <sm:authorizationMap>
+  	      <sm:authorizationMap>
+  	        <!-- ACL list -->
+  	        <sm:authorizationEntries>
+  	          <!-- By default, only 'admin' role can access JBI endpoints -->
+  	          <sm:authorizationEntry service="*:*" roles="admin" />
+  	          <!-- ex:receiver service is authorized for role 'secure' -->
+  	          <sm:authorizationEntry service="ex:receiver" roles="secure" />
+  	        </sm:authorizationEntries>
+  	      </sm:authorizationMap>
+        </sm:authorizationMap>
+      </sm:securedBroker>
+    </sm:broker>
+    
+      
+    <sm:activationSpecs>
+
+  	  <sm:activationSpec id="http">
+  	    <sm:component>
+  	      <http:component>
+  	        <http:endpoints>
+  	        
+  	          <!-- Secured endpoint using http basic authentication -->
+  	          <http:endpoint service="ex:receiver"
+  	                         endpoint="http"
+  	                         targetService="ex:receiver"
+  	                         role="consumer"
+  	                         locationURI="http://localhost:8192/Service/"
+  	          				       authMethod="basic" 
+  	          				       defaultMep="http://www.w3.org/2004/08/wsdl/in-only">
+              </http:endpoint>
+                
+  	          <!-- Secured endpoint using ws-sec authentication -->
+              <http:endpoint service="ex:receiver"
+                             endpoint="http-wssec"
+                             targetService="ex:receiver"
+                             role="consumer"
+                             locationURI="http://localhost:8192/WSSec/"
+                             defaultMep="http://www.w3.org/2004/08/wsdl/in-only"
+                             soap="true">
+                 <http:policies>
+                   <soap:ws-addressing />
+                   <!-- Enable ws-sec with UsernameToken -->
+                   <soap:ws-security receiveAction="UsernameToken" />
+                 </http:policies>
+              </http:endpoint>
+              
+  	        </http:endpoints>
+  	      </http:component>
+  	    </sm:component>
+  	  </sm:activationSpec>
+
+      <!-- Secured endpoint -->
+      <sm:activationSpec id="receiver" service="ex:receiver">
+        <sm:component>
+          <bean class="org.apache.servicemix.tck.ReceiverComponent" />
+        </sm:component>
+      </sm:activationSpec>
+
+    </sm:activationSpecs>
+  </sm:container>
+
+</beans>

Added: incubator/servicemix/trunk/samples/ws-sec/src/main/resources/users.properties
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/ws-sec/src/main/resources/users.properties?rev=430086&view=auto
==============================================================================
--- incubator/servicemix/trunk/samples/ws-sec/src/main/resources/users.properties (added)
+++ incubator/servicemix/trunk/samples/ws-sec/src/main/resources/users.properties Wed Aug
 9 09:29:38 2006
@@ -0,0 +1,3 @@
+system=manager
+user1=user1
+user2=user2



Mime
View raw message