http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/README.txt ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/README.txt b/examples/cxf/cxf-ws-security-blueprint/README.txt deleted file mode 100644 index 0a9c17c..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/README.txt +++ /dev/null @@ -1,257 +0,0 @@ -/* - * 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. - */ - -CXF WS-SECURITY OSGi HTTP WEB SERVICE -========================= - -Purpose -------- -Create a web service with CXF using WS-SECURITY and blueprint configuration, -and expose it through the OSGi HTTP -Service, then it will leverage cxf JAASLoginInterceptor to authenticate against karaf -default jaas configuration. - - -Explanation ------------ -The web service is a simple JAX-WS web service with ws-security UsernameToken action called HelloWorldSecurity. The -interface and the implementation are located in the src/main/java/org/ -apache/servicemix/examples/cxf directory of this example. - -The blueprint.xml file, located in the src/main/resources/OSGI-INF/blueprint -directory: - - -1. Configures the web service endpoint as follows: - - <jaxws:endpoint id="helloWorld" - implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl" - address="/HelloWorldSecurity"> - <jaxws:inInterceptors> - <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> - <property name="properties"> - <map> - <entry key="action" value="UsernameToken"/> - <entry key="passwordType" value="PasswordTest"/> - </map> - </property> - </bean> - <ref component-id="authenticationInterceptor"/> - </jaxws:inInterceptors> - <jaxws:properties> - <entry key="ws-security.validate.token" value="false"/> - </jaxws:properties> - </jaxws:endpoint> - <bean id="authenticationInterceptor" class="org.apache.cxf.interceptor.security.JAASLoginInterceptor"> - <property name="contextName" value="karaf"/> - </bean> - -This will leverage cxf JAASLoginInterceptor to authenticate against karaf default jaas configuration through property contextName, which store username/password/role in SMX_HOME/etc/users.properties. Users can easily change to use other jaas context(JDBC,LDAP etc) as described from http://karaf.apache.org/manual/2.2.4/developers-guide/security-framework.html. - - -Prerequisites for Running the Example -------------------------------------- -1. You must have the following installed on your machine: - - - JDK 1.6 or higher - - - Maven 2.2.1 or higher - - For more information, see the README in the top-level examples - directory. - - -2. Start ServiceMix by running the following command: - - <servicemix_home>/bin/servicemix (on UNIX) - <servicemix_home>\bin\servicemix (on Windows) - - -Running the Example -------------------- -You can run the example in two ways: - -- A. Using a Prebuilt Deployment Bundle: Quick and Easy -This option is useful if you want to see the example up and -running as quickly as possible. - -- B. Building the Example Bundle Yourself -This option is useful if you want to change the example in any -way. It tells you how to build and deploy the example. This -option might be slower than option A because, if you do not -already have the required bundles in your local Maven -repository, Maven will have to download the bundles it needs. - -A. Using a Prebuilt Deployment Bundle: Quick and Easy ------------------------------------------------------ -To install and run a prebuilt version of this example, enter -the following command in the ServiceMix console: - - features:install examples-cxf-ws-security-blueprint - -This command makes use of the ServiceMix features facility. For -more information about the features facility, see the README.txt -file in the examples parent directory. - -To view the service WSDL, open your browser and go to the following -URL: - - http://localhost:8181/cxf/HelloWorldSecurity?wsdl - -Note, if you use Safari, right click the window and select -'Show Source'. - -Running a Client ----------------- -To run the web client: - -1. Open the client.html, which is located in the same directory as - this README file, in your favorite browser. - -2. Click the Send button to send a request. - - Once the request has been successfully sent, a response similar - to the following should appear in the right-hand panel of the - web page: - - STATUS: 200 - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> - <soap:Body><ns2:sayHiResponse xmlns:ns2="http://cxf.examples. - servicemix.apache.org/"><return>Hello John Doe</return> - </ns2:sayHiResponse> - </soap:Body> - </soap:Envelope> - -To run the java code client: - -1. Change to the <servicemix_home>/examples/cxf/cxf-ws-security-blueprint - directory. - -2. Run the following command: - - mvn compile exec:java - - If the client request is successful, - it will print out - Hello ffang - - -Changing /cxf servlet alias ---------------------------- -By default CXF Servlet is assigned a '/cxf' alias. You can -change it in a couple of ways - -a. Add org.apache.cxf.osgi.cfg to the /etc directory and set - the 'org.apache.cxf.servlet.context' property, for example: - - org.apache.cxf.servlet.context=/custom - -b. Use shell config commands, for example : - - config:edit org.apache.cxf.osgi - config:propset org.apache.cxf.servlet.context /super - config:update - - -B. Building the Example Bundle Yourself ---------------------------------------- -To install and run the example where you build the example bundle -yourself, complete the following steps: - -1. If you have already run the example using the prebuilt version as - described above, you must first uninstall the examples-cxf-ws-security-blueprint - feature by entering the following command in the ServiceMix console: - - features:uninstall examples-cxf-ws-security-blueprint - - -2. Build the example by opening a command prompt, changing directory to - examples/cxf-ws-security-blueprint (this example) and entering the following Maven - command: - - mvn install - - If all of the required OSGi bundles are available in your local - Maven repository, the example will build very quickly. Otherwise - it may take some time for Maven to download everything it needs. - - The mvn install command builds the example deployment bundle and - copies it to your local Maven repository and to the target directory - of this example. - -3. Install the example by entering the following command in - the ServiceMix console: - - features:install examples-cxf-ws-security-blueprint - - It makes use of the ServiceMix features facility. For more - information about the features facility, see the README.txt file - in the examples parent directory. - -To view the service WSDL, open your browser and go to the following -URL: - - http://localhost:8181/cxf/HelloWorldSecurity?wsdl - -Note, if you use Safari, right click the window and select -'Show Source'. - -You can try running a client against your service by following the -instructions in the "Running a Client" section above. - - -Stopping and Uninstalling the Example -------------------------------------- -To stop the example, you must first know the bundle ID that ServiceMix -has assigned to it. To get the bundle ID, enter the following command -at the ServiceMix console: - - osgi:list - -At the end of the listing, you should see an entry similar to the -following: - - [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF WS SECURITY OSGI (4.2.0.0) - -In this case, the bundle ID is 170. - -To stop the example, enter the following command at the ServiceMix -console: - - osgi:stop <bundle_id> - -For example: - - osgi:stop 170 - -To uninstall the example, enter one of the following commands in -the ServiceMix console: - - features:uninstall examples-cxf-ws-security-blueprint - -or - - osgi:uninstall <bundle_id> - - -Viewing the Log Entries ------------------------ -You can view the entries in the log file in the data/log -directory of your ServiceMix installation, or by typing -the following command in the ServiceMix console: - - log:display
http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/client.html ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/client.html b/examples/cxf/cxf-ws-security-blueprint/client.html deleted file mode 100644 index 007d566..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/client.html +++ /dev/null @@ -1,144 +0,0 @@ -<!-- - - 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. - ---> -<html> -<head> -<title>ServiceMix 4 CXF-WS-SECURITY-OSGi Example</title> -<script type="text/javascript"> -var urlToOpen = "http://localhost:8181/cxf/HelloWorldSecurity"; //default URL to open - -function getHTTPObject() { - var xmlhttp = false; - - /* Compilation conditionnelle d'IE */ - /* Check if we are using 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 */ - /* Create the xmlhttp object if it is not yet defined */ - 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 */ - /* Define the callback function for the response */ - xmlhttp.onreadystatechange=function() { - if (xmlhttp.readyState == 4) { /* 4 : �tat "complete" */ - var response = document.getElementById("response"); - var responseStatus = ""; - try { - responseStatus = xmlhttp.status + ""; - } catch (e) { - responseStatus = "ERROR WHILE RETRIEVING STATUS; MAYBE UNABLE TO CONNECT."; - } - response.value = "STATUS: " + responseStatus + "\n" + xmlhttp.responseText; - } - } - } - return xmlhttp; -} - -function send() { - if ((document.getElementById("urlToOpen").value != urlToOpen) && (document.getElementById("urlToOpen").value != "")) { - // use user entry if it is not the empty string - urlToOpen = document.getElementById("urlToOpen").value; - } - 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"); - } catch (e) { - } - try { - xmlhttp.open("POST", urlToOpen, true); - } catch (e) { - alert('error opening'); - } - xmlhttp.send(request.value); -} - -</script> -</head> - -<body> - -<h1>ServiceMix 4 CXF-WS-SECURITY-OSGi Example</h1> - -<p>Welcome to the CXF-WS-SECURITY-OSGi example for ServiceMix 4</p> - -<p>Perform a POST into the HTTP binding. This requires JavaScript.</p> -<p>Target: <input type="text" size="50" id="urlToOpen" value=""><script type="text/javascript">document.getElementById("urlToOpen").value = urlToOpen;</script>.</p> - -<table> - <tr> - <td> - <textarea id="request" style="width:600px;height:400px"><?xml version="1.0" encoding="UTF-8"?> - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> - <soap:Header> - <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> - <wsse:UsernameToken > - <wsse:Username>smx</wsse:Username> - <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">smx</wsse:Password> - </wsse:UsernameToken> - </wsse:Security> - </soap:Header> - <soap:Body> - <ns2:sayHi xmlns:ns2="http://cxf.examples.servicemix.apache.org/"> - <arg0>John Doe</arg0> - </ns2:sayHi> - </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> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/pom.xml ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/pom.xml b/examples/cxf/cxf-ws-security-blueprint/pom.xml deleted file mode 100644 index 9ba0c2c..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <!-- - - 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. - --> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.servicemix.examples</groupId> - <artifactId>cxf</artifactId> - <version>4.6.0-SNAPSHOT</version> - </parent> - - <artifactId>cxf-ws-security-blueprint</artifactId> - <packaging>bundle</packaging> - <name>Apache ServiceMix :: Features :: Examples :: CXF WS-Security Blueprint</name> - <description>CXF example using WS-Security with Blueprint</description> - <dependencies> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-ws-metadata_2.0_spec</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicemix</groupId> - <artifactId>servicemix-utils</artifactId> - </dependency> - <dependency> - <groupId>org.apache.ws.security</groupId> - <artifactId>wss4j</artifactId> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-transports-http</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-ws-security</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-frontend-jaxws</artifactId> - <version>${cxf.version}</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <configuration> - <instructions> - <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> - <Bundle-Description>${project.description}</Bundle-Description> - <Import-Package> - javax.jws, - javax.xml.bind.annotation, - javax.wsdl, - org.osgi.service.blueprint, - org.apache.cxf.ws.security.wss4j, - javax.security.auth.callback, - org.apache.ws.security, - org.apache.ws.security.processor, - org.apache.cxf.interceptor.security, - org.apache.cxf.transport.http, - org.apache.cxf, org.apache.cxf.endpoint, org.apache.cxf.frontend, org.apache.cxf.interceptor, org.apache.cxf.jaxws, org.apache.cxf.message, org.apache.cxf.phase - </Import-Package> - <Export-Package>org.apache.servicemix.examples.cxf</Export-Package> - </instructions> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <configuration> - <mainClass>org.apache.servicemix.examples.cxf.Client</mainClass> - <includePluginDependencies>false</includePluginDependencies> - </configuration> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/Client.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/Client.java b/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/Client.java deleted file mode 100644 index b79abad..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/Client.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -package org.apache.servicemix.examples.cxf; - - -import java.util.HashMap; -import java.util.Map; - -import org.apache.cxf.frontend.ClientProxy; -import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; -import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; - - -public class Client{ - public static void main(String[] args) { - try { - new Client().sendRequest(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void sendRequest() throws Exception { - JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); - factory.setServiceClass(HelloWorld.class); - factory.setAddress("http://localhost:8181/cxf/HelloWorldSecurity"); - HelloWorld client = (HelloWorld) factory.create(); - - Map<String, Object> outProps = new HashMap<String, Object>(); - outProps.put("action", "UsernameToken"); - - //add a CustomerSecurityInterceptor for client side to init wss4j staff - //retrieve and set user/password, users can easily add this interceptor - //through spring configuration also - ClientProxy.getClient(client).getOutInterceptors().add(new CustomerSecurityInterceptor()); - ClientProxy.getClient(client).getOutInterceptors().add(new WSS4JOutInterceptor()); - String ret = client.sayHi("ffang"); - System.out.println(ret); - } - -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java b/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java deleted file mode 100644 index f2687af..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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. - */ - -package org.apache.servicemix.examples.cxf; - -import java.io.IOException; -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.UnsupportedCallbackException; -import org.apache.ws.security.WSPasswordCallback; - -public class ClientPasswordCallback implements CallbackHandler { - - public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { - - WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; - - if (pc.getIdentifier().equals("smx")) { - pc.setPassword("smx"); - } - } - -} - - http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java b/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java deleted file mode 100644 index d19cad6..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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. - */ - -package org.apache.servicemix.examples.cxf; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.interceptor.Interceptor; -import org.apache.cxf.message.Message; -import org.apache.cxf.phase.AbstractPhaseInterceptor; -import org.apache.cxf.phase.Phase; -import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; - -public class CustomerSecurityInterceptor extends AbstractPhaseInterceptor<Message> { - - public CustomerSecurityInterceptor() { - super(Phase.SETUP); - } - - public void handleMessage(Message message) throws Fault { - Map<String, Object> outProps = new HashMap<String, Object>(); - outProps.put("action", "UsernameToken"); - - outProps.put("passwordType", "PasswordText"); - outProps.put("user", "smx"); - outProps.put("passwordCallbackClass", "org.apache.servicemix.examples.cxf.ClientPasswordCallback"); - for (Interceptor inteceptor : message.getInterceptorChain()) { - //set properties for WSS4JOutInterceptor - if (inteceptor.getClass().getName().equals("org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor")) { - ((WSS4JOutInterceptor)inteceptor).setProperties(outProps); - } - } - } - - -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java b/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java deleted file mode 100644 index 9cf28b1..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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. - */ -package org.apache.servicemix.examples.cxf; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.message.Message; -import org.apache.cxf.phase.AbstractPhaseInterceptor; -import org.apache.cxf.phase.Phase; -import org.apache.cxf.transport.http.Headers; - -public class EnableCORSInterceptor extends AbstractPhaseInterceptor<Message> { - - public EnableCORSInterceptor() { - super(Phase.PRE_PROTOCOL); - } - - @Override - public void handleMessage(Message message) throws Fault { - Map<String, List<String>> headers = Headers.getSetProtocolHeaders(message); - try { - //Access-Control-Allow-Origin:* Access-Control-Allow-Methods:POST,GET - headers.put("Access-Control-Allow-Origin", Arrays.asList("*")); - headers.put("Access-Control-Allow-Methods", Arrays.asList("POST", "GET")); - } catch (Exception ce) { - throw new Fault(ce); - } - } -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java b/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java deleted file mode 100644 index 14dad3a..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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. - */ -// START SNIPPET: service -package org.apache.servicemix.examples.cxf; - -import javax.jws.WebService; - -@WebService -public interface HelloWorld { - String sayHi(String text); -} -// END SNIPPET: service http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java b/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java deleted file mode 100644 index 85fd25f..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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. - */ -// START SNIPPET: service -package org.apache.servicemix.examples.cxf; - -import javax.jws.WebService; - -@WebService(endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld") -public class HelloWorldImpl implements HelloWorld { - - public String sayHi(String text) { - return "Hello " + text; - } -} -// END SNIPPET: service http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/examples/cxf/cxf-ws-security-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml deleted file mode 100755 index 6e7a504..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?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. ---> -<!-- START SNIPPET: beans --> -<blueprint - xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws" - xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd - http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd"> - - - <jaxws:endpoint id="helloWorld" - implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl" - address="/HelloWorldSecurity"> - <jaxws:inInterceptors> - <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> - <property name="properties"> - <map> - <entry key="action" value="UsernameToken"/> - <entry key="passwordType" value="PasswordTest"/> - </map> - </property> - </bean> - <ref component-id="authenticationInterceptor"/> - </jaxws:inInterceptors> - <jaxws:outInterceptors> - <bean class="org.apache.servicemix.examples.cxf.EnableCORSInterceptor"/> - </jaxws:outInterceptors> - <jaxws:properties> - <entry key="ws-security.validate.token" value="false"/> - </jaxws:properties> - </jaxws:endpoint> - <bean id="authenticationInterceptor" class="org.apache.cxf.interceptor.security.JAASLoginInterceptor"> - <property name="contextName" value="karaf"/> - </bean> - -</blueprint> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-blueprint/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-blueprint/src/main/resources/log4j.properties b/examples/cxf/cxf-ws-security-blueprint/src/main/resources/log4j.properties deleted file mode 100644 index 36af21f..0000000 --- a/examples/cxf/cxf-ws-security-blueprint/src/main/resources/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -# Root logger option -log4j.rootLogger=INFO, stdout - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n - http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/README.txt ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/README.txt b/examples/cxf/cxf-ws-security-osgi/README.txt deleted file mode 100644 index 6d94bf3..0000000 --- a/examples/cxf/cxf-ws-security-osgi/README.txt +++ /dev/null @@ -1,256 +0,0 @@ -/* - * 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. - */ - -CXF WS-SECURITY OSGi HTTP WEB SERVICE -========================= - -Purpose -------- -Create a web service with CXF using WS-SECURITY and expose it through the OSGi HTTP -Service, then it will leverage cxf JAASLoginInterceptor to authenticate against karaf -default jaas configuration. - - -Explanation ------------ -The web service is a simple JAX-WS web service with ws-security UsernameToken action called HelloWorldSecurity. The -interface and the implementation are located in the src/main/java/org/ -apache/servicemix/examples/cxf directory of this example. - -The beans.xml file, located in the src/main/resources/META-INF/spring -directory: - - -1. Configures the web service endpoint as follows: - - <jaxws:endpoint id="helloWorld" - implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl" - address="/HelloWorldSecurity"> - <jaxws:inInterceptors> - <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> - <constructor-arg> - <map> - <entry key="action" value="UsernameToken"/> - <entry key="passwordType" value="PasswordText"/> - </map> - </constructor-arg> - </bean> - <ref bean="authenticationInterceptor"/> - </jaxws:inInterceptors> - <jaxws:properties> - <entry key="ws-security.validate.token" value="false"/> - </jaxws:properties> - </jaxws:endpoint> - <bean id="authenticationInterceptor" class="org.apache.cxf.interceptor.security.JAASLoginInterceptor"> - <property name="contextName" value="karaf"/> - </bean> - -This will leverage cxf JAASLoginInterceptor to authenticate against karaf default jaas configuration through property contextName, which store username/password/role in SMX_HOME/etc/users.properties. Users can easily change to use other jaas context(JDBC,LDAP etc) as described from http://karaf.apache.org/manual/2.2.4/developers-guide/security-framework.html. - - -Prerequisites for Running the Example -------------------------------------- -1. You must have the following installed on your machine: - - - JDK 1.6 or higher - - - Maven 2.2.1 or higher - - For more information, see the README in the top-level examples - directory. - - -2. Start ServiceMix by running the following command: - - <servicemix_home>/bin/servicemix (on UNIX) - <servicemix_home>\bin\servicemix (on Windows) - - -Running the Example -------------------- -You can run the example in two ways: - -- A. Using a Prebuilt Deployment Bundle: Quick and Easy -This option is useful if you want to see the example up and -running as quickly as possible. - -- B. Building the Example Bundle Yourself -This option is useful if you want to change the example in any -way. It tells you how to build and deploy the example. This -option might be slower than option A because, if you do not -already have the required bundles in your local Maven -repository, Maven will have to download the bundles it needs. - -A. Using a Prebuilt Deployment Bundle: Quick and Easy ------------------------------------------------------ -To install and run a prebuilt version of this example, enter -the following command in the ServiceMix console: - - features:install examples-cxf-ws-security-osgi - -This command makes use of the ServiceMix features facility. For -more information about the features facility, see the README.txt -file in the examples parent directory. - -To view the service WSDL, open your browser and go to the following -URL: - - http://localhost:8181/cxf/HelloWorldSecurity?wsdl - -Note, if you use Safari, right click the window and select -'Show Source'. - -Running a Client ----------------- -To run the web client: - -1. Open the client.html, which is located in the same directory as - this README file, in your favorite browser. - -2. Click the Send button to send a request. - - Once the request has been successfully sent, a response similar - to the following should appear in the right-hand panel of the - web page: - - STATUS: 200 - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> - <soap:Body><ns2:sayHiResponse xmlns:ns2="http://cxf.examples. - servicemix.apache.org/"><return>Hello John Doe</return> - </ns2:sayHiResponse> - </soap:Body> - </soap:Envelope> - -To run the java code client: - -1. Change to the <servicemix_home>/examples/cxf/cxf-ws-security-osgi - directory. - -2. Run the following command: - - mvn compile exec:java - - If the client request is successful, - it will print out - Hello ffang - - -Changing /cxf servlet alias ---------------------------- -By default CXF Servlet is assigned a '/cxf' alias. You can -change it in a couple of ways - -a. Add org.apache.cxf.osgi.cfg to the /etc directory and set - the 'org.apache.cxf.servlet.context' property, for example: - - org.apache.cxf.servlet.context=/custom - -b. Use shell config commands, for example : - - config:edit org.apache.cxf.osgi - config:propset org.apache.cxf.servlet.context /super - config:update - - -B. Building the Example Bundle Yourself ---------------------------------------- -To install and run the example where you build the example bundle -yourself, complete the following steps: - -1. If you have already run the example using the prebuilt version as - described above, you must first uninstall the examples-cxf-ws-security-osgi - feature by entering the following command in the ServiceMix console: - - features:uninstall examples-cxf-ws-security-osgi - - -2. Build the example by opening a command prompt, changing directory to - examples/cxf-ws-security-osgi (this example) and entering the following Maven - command: - - mvn install - - If all of the required OSGi bundles are available in your local - Maven repository, the example will build very quickly. Otherwise - it may take some time for Maven to download everything it needs. - - The mvn install command builds the example deployment bundle and - copies it to your local Maven repository and to the target directory - of this example. - -3. Install the example by entering the following command in - the ServiceMix console: - - features:install examples-cxf-ws-security-osgi - - It makes use of the ServiceMix features facility. For more - information about the features facility, see the README.txt file - in the examples parent directory. - -To view the service WSDL, open your browser and go to the following -URL: - - http://localhost:8181/cxf/HelloWorldSecurity?wsdl - -Note, if you use Safari, right click the window and select -'Show Source'. - -You can try running a client against your service by following the -instructions in the "Running a Client" section above. - - -Stopping and Uninstalling the Example -------------------------------------- -To stop the example, you must first know the bundle ID that ServiceMix -has assigned to it. To get the bundle ID, enter the following command -at the ServiceMix console: - - osgi:list - -At the end of the listing, you should see an entry similar to the -following: - - [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF WS SECURITY OSGI (4.2.0.0) - -In this case, the bundle ID is 170. - -To stop the example, enter the following command at the ServiceMix -console: - - osgi:stop <bundle_id> - -For example: - - osgi:stop 170 - -To uninstall the example, enter one of the following commands in -the ServiceMix console: - - features:uninstall examples-cxf-ws-security-osgi - -or - - osgi:uninstall <bundle_id> - - -Viewing the Log Entries ------------------------ -You can view the entries in the log file in the data/log -directory of your ServiceMix installation, or by typing -the following command in the ServiceMix console: - - log:display http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/client.html ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/client.html b/examples/cxf/cxf-ws-security-osgi/client.html deleted file mode 100644 index 007d566..0000000 --- a/examples/cxf/cxf-ws-security-osgi/client.html +++ /dev/null @@ -1,144 +0,0 @@ -<!-- - - 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. - ---> -<html> -<head> -<title>ServiceMix 4 CXF-WS-SECURITY-OSGi Example</title> -<script type="text/javascript"> -var urlToOpen = "http://localhost:8181/cxf/HelloWorldSecurity"; //default URL to open - -function getHTTPObject() { - var xmlhttp = false; - - /* Compilation conditionnelle d'IE */ - /* Check if we are using 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 */ - /* Create the xmlhttp object if it is not yet defined */ - 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 */ - /* Define the callback function for the response */ - xmlhttp.onreadystatechange=function() { - if (xmlhttp.readyState == 4) { /* 4 : �tat "complete" */ - var response = document.getElementById("response"); - var responseStatus = ""; - try { - responseStatus = xmlhttp.status + ""; - } catch (e) { - responseStatus = "ERROR WHILE RETRIEVING STATUS; MAYBE UNABLE TO CONNECT."; - } - response.value = "STATUS: " + responseStatus + "\n" + xmlhttp.responseText; - } - } - } - return xmlhttp; -} - -function send() { - if ((document.getElementById("urlToOpen").value != urlToOpen) && (document.getElementById("urlToOpen").value != "")) { - // use user entry if it is not the empty string - urlToOpen = document.getElementById("urlToOpen").value; - } - 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"); - } catch (e) { - } - try { - xmlhttp.open("POST", urlToOpen, true); - } catch (e) { - alert('error opening'); - } - xmlhttp.send(request.value); -} - -</script> -</head> - -<body> - -<h1>ServiceMix 4 CXF-WS-SECURITY-OSGi Example</h1> - -<p>Welcome to the CXF-WS-SECURITY-OSGi example for ServiceMix 4</p> - -<p>Perform a POST into the HTTP binding. This requires JavaScript.</p> -<p>Target: <input type="text" size="50" id="urlToOpen" value=""><script type="text/javascript">document.getElementById("urlToOpen").value = urlToOpen;</script>.</p> - -<table> - <tr> - <td> - <textarea id="request" style="width:600px;height:400px"><?xml version="1.0" encoding="UTF-8"?> - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> - <soap:Header> - <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> - <wsse:UsernameToken > - <wsse:Username>smx</wsse:Username> - <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">smx</wsse:Password> - </wsse:UsernameToken> - </wsse:Security> - </soap:Header> - <soap:Body> - <ns2:sayHi xmlns:ns2="http://cxf.examples.servicemix.apache.org/"> - <arg0>John Doe</arg0> - </ns2:sayHi> - </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> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/pom.xml ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/pom.xml b/examples/cxf/cxf-ws-security-osgi/pom.xml deleted file mode 100644 index 6b81d75..0000000 --- a/examples/cxf/cxf-ws-security-osgi/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <!-- - - 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. - --> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.servicemix.examples</groupId> - <artifactId>cxf</artifactId> - <version>4.6.0-SNAPSHOT</version> - </parent> - - <artifactId>cxf-ws-security-osgi</artifactId> - <packaging>bundle</packaging> - <name>Apache ServiceMix :: Features :: Examples :: CXF WS-Security OSGi</name> - <description>CXF example using WS-Security</description> - <dependencies> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-ws-metadata_2.0_spec</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicemix</groupId> - <artifactId>servicemix-utils</artifactId> - </dependency> - <dependency> - <groupId>org.apache.ws.security</groupId> - <artifactId>wss4j</artifactId> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-transports-http</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-ws-security</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-frontend-jaxws</artifactId> - <version>${cxf.version}</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <configuration> - <instructions> - <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> - <Bundle-Description>${project.description}</Bundle-Description> - <Import-Package> - javax.jws, - javax.xml.bind.annotation, - javax.wsdl, - org.apache.cxf.ws.security.wss4j, - org.springframework.beans.factory.config, - javax.security.auth.callback, - org.apache.ws.security, - org.apache.ws.security.processor, - org.apache.cxf.interceptor.security, - org.apache.cxf.transport.http, - org.apache.cxf, org.apache.cxf.endpoint, org.apache.cxf.frontend, org.apache.cxf.interceptor, org.apache.cxf.jaxws, org.apache.cxf.message, org.apache.cxf.phase - </Import-Package> - <Export-Package>org.apache.servicemix.examples.cxf</Export-Package> - </instructions> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <configuration> - <mainClass>org.apache.servicemix.examples.cxf.Client</mainClass> - <includePluginDependencies>false</includePluginDependencies> - </configuration> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/Client.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/Client.java b/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/Client.java deleted file mode 100644 index b79abad..0000000 --- a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/Client.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -package org.apache.servicemix.examples.cxf; - - -import java.util.HashMap; -import java.util.Map; - -import org.apache.cxf.frontend.ClientProxy; -import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; -import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; - - -public class Client{ - public static void main(String[] args) { - try { - new Client().sendRequest(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void sendRequest() throws Exception { - JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); - factory.setServiceClass(HelloWorld.class); - factory.setAddress("http://localhost:8181/cxf/HelloWorldSecurity"); - HelloWorld client = (HelloWorld) factory.create(); - - Map<String, Object> outProps = new HashMap<String, Object>(); - outProps.put("action", "UsernameToken"); - - //add a CustomerSecurityInterceptor for client side to init wss4j staff - //retrieve and set user/password, users can easily add this interceptor - //through spring configuration also - ClientProxy.getClient(client).getOutInterceptors().add(new CustomerSecurityInterceptor()); - ClientProxy.getClient(client).getOutInterceptors().add(new WSS4JOutInterceptor()); - String ret = client.sayHi("ffang"); - System.out.println(ret); - } - -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java b/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java deleted file mode 100755 index f2687af..0000000 --- a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/ClientPasswordCallback.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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. - */ - -package org.apache.servicemix.examples.cxf; - -import java.io.IOException; -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.UnsupportedCallbackException; -import org.apache.ws.security.WSPasswordCallback; - -public class ClientPasswordCallback implements CallbackHandler { - - public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { - - WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; - - if (pc.getIdentifier().equals("smx")) { - pc.setPassword("smx"); - } - } - -} - - http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java b/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java deleted file mode 100644 index d19cad6..0000000 --- a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/CustomerSecurityInterceptor.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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. - */ - -package org.apache.servicemix.examples.cxf; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.interceptor.Interceptor; -import org.apache.cxf.message.Message; -import org.apache.cxf.phase.AbstractPhaseInterceptor; -import org.apache.cxf.phase.Phase; -import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; - -public class CustomerSecurityInterceptor extends AbstractPhaseInterceptor<Message> { - - public CustomerSecurityInterceptor() { - super(Phase.SETUP); - } - - public void handleMessage(Message message) throws Fault { - Map<String, Object> outProps = new HashMap<String, Object>(); - outProps.put("action", "UsernameToken"); - - outProps.put("passwordType", "PasswordText"); - outProps.put("user", "smx"); - outProps.put("passwordCallbackClass", "org.apache.servicemix.examples.cxf.ClientPasswordCallback"); - for (Interceptor inteceptor : message.getInterceptorChain()) { - //set properties for WSS4JOutInterceptor - if (inteceptor.getClass().getName().equals("org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor")) { - ((WSS4JOutInterceptor)inteceptor).setProperties(outProps); - } - } - } - - -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java b/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java deleted file mode 100644 index 9cf28b1..0000000 --- a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/EnableCORSInterceptor.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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. - */ -package org.apache.servicemix.examples.cxf; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.message.Message; -import org.apache.cxf.phase.AbstractPhaseInterceptor; -import org.apache.cxf.phase.Phase; -import org.apache.cxf.transport.http.Headers; - -public class EnableCORSInterceptor extends AbstractPhaseInterceptor<Message> { - - public EnableCORSInterceptor() { - super(Phase.PRE_PROTOCOL); - } - - @Override - public void handleMessage(Message message) throws Fault { - Map<String, List<String>> headers = Headers.getSetProtocolHeaders(message); - try { - //Access-Control-Allow-Origin:* Access-Control-Allow-Methods:POST,GET - headers.put("Access-Control-Allow-Origin", Arrays.asList("*")); - headers.put("Access-Control-Allow-Methods", Arrays.asList("POST", "GET")); - } catch (Exception ce) { - throw new Fault(ce); - } - } -} http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java b/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java deleted file mode 100755 index 14dad3a..0000000 --- a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorld.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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. - */ -// START SNIPPET: service -package org.apache.servicemix.examples.cxf; - -import javax.jws.WebService; - -@WebService -public interface HelloWorld { - String sayHi(String text); -} -// END SNIPPET: service http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java b/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java deleted file mode 100755 index 85fd25f..0000000 --- a/examples/cxf/cxf-ws-security-osgi/src/main/java/org/apache/servicemix/examples/cxf/HelloWorldImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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. - */ -// START SNIPPET: service -package org.apache.servicemix.examples.cxf; - -import javax.jws.WebService; - -@WebService(endpointInterface = "org.apache.servicemix.examples.cxf.HelloWorld") -public class HelloWorldImpl implements HelloWorld { - - public String sayHi(String text) { - return "Hello " + text; - } -} -// END SNIPPET: service http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/src/main/resources/META-INF/spring/beans.xml ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/src/main/resources/META-INF/spring/beans.xml b/examples/cxf/cxf-ws-security-osgi/src/main/resources/META-INF/spring/beans.xml deleted file mode 100755 index 086b2f7..0000000 --- a/examples/cxf/cxf-ws-security-osgi/src/main/resources/META-INF/spring/beans.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?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. ---> -<!-- START SNIPPET: beans --> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:jaxws="http://cxf.apache.org/jaxws" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> - - - <jaxws:endpoint id="helloWorld" - implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl" - address="/HelloWorldSecurity"> - <jaxws:inInterceptors> - <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> - <constructor-arg> - <map> - <entry key="action" value="UsernameToken"/> - <entry key="passwordType" value="PasswordText"/> - </map> - </constructor-arg> - </bean> - <ref bean="authenticationInterceptor"/> - </jaxws:inInterceptors> - <jaxws:outInterceptors> - <bean class="org.apache.servicemix.examples.cxf.EnableCORSInterceptor"/> - </jaxws:outInterceptors> - <jaxws:properties> - <entry key="ws-security.validate.token" value="false"/> - </jaxws:properties> - </jaxws:endpoint> - <bean id="authenticationInterceptor" class="org.apache.cxf.interceptor.security.JAASLoginInterceptor"> - <property name="contextName" value="karaf"/> - </bean> - -</beans> -<!-- END SNIPPET: beans --> http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-osgi/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-osgi/src/main/resources/log4j.properties b/examples/cxf/cxf-ws-security-osgi/src/main/resources/log4j.properties deleted file mode 100644 index 1da8230..0000000 --- a/examples/cxf/cxf-ws-security-osgi/src/main/resources/log4j.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Root logger option -log4j.rootLogger=INFO, stdout - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-signature/README.txt ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-signature/README.txt b/examples/cxf/cxf-ws-security-signature/README.txt deleted file mode 100644 index 7dd381b..0000000 --- a/examples/cxf/cxf-ws-security-signature/README.txt +++ /dev/null @@ -1,248 +0,0 @@ -/* - * 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. - */ - -CXF WS-SECURITY OSGi HTTP WEB SERVICE -========================= - -Purpose -------- -Create a web service with CXF using WS-SECURITY Signature action and expose it through the OSGi HTTP -Service, the main purpose is to demonstrate how to use signaturePropRefId WSS4J configuration in -OSGi container. - - -Explanation ------------ -The web service is a simple JAX-WS web service with ws-security Signature and UsernameToken action called HelloWorldSecurity. The -interface and the implementation are located in the src/main/java/org/ -apache/servicemix/examples/cxf directory of this example. - -The beans.xml file, located in the src/main/resources/META-INF/spring -directory: - - -1. Configures the web service endpoint as follows: - - <jaxws:endpoint id="helloWorld" - implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl" - address="/HelloWorldSecurity"> - <jaxws:inInterceptors> - <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> - <constructor-arg> - <map> - <entry key="action" value="UsernameToken Signature"/> - <entry key="passwordType" value="PasswordText"/> - <entry key="passwordCallbackRef"> - <ref bean="myPasswordCallback"/> - </entry> - <entry key="signaturePropRefId" value="wsCryptoProperties"/> - <entry key="wsCryptoProperties" value-ref="wsCryptoProperties"/> - </map> - </constructor-arg> - </bean> - <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" /> - </jaxws:inInterceptors> - </jaxws:endpoint> - - <util:properties id="wsCryptoProperties"> - - <prop - key="org.apache.ws.security.crypto.provider">org.apache.ws.security.components.crypto.Merlin</prop> - - <prop - key="org.apache.ws.security.crypto.merlin.keystore.type">jks</prop> - - <prop - key="org.apache.ws.security.crypto.merlin.keystore.password">storepassword</prop> - - <prop - key="org.apache.ws.security.crypto.merlin.file">server-truststore.jks</prop> - </util:properties> - -Prerequisites for Running the Example -------------------------------------- -1. You must have the following installed on your machine: - - - JDK 1.6 or higher - - - Maven 2.2.1 or higher - - For more information, see the README in the top-level examples - directory. - - -2. Start ServiceMix by running the following command: - - <servicemix_home>/bin/servicemix (on UNIX) - <servicemix_home>\bin\servicemix (on Windows) - - -Running the Example -------------------- -You can run the example in two ways: - -- A. Using a Prebuilt Deployment Bundle: Quick and Easy -This option is useful if you want to see the example up and -running as quickly as possible. - -- B. Building the Example Bundle Yourself -This option is useful if you want to change the example in any -way. It tells you how to build and deploy the example. This -option might be slower than option A because, if you do not -already have the required bundles in your local Maven -repository, Maven will have to download the bundles it needs. - -A. Using a Prebuilt Deployment Bundle: Quick and Easy ------------------------------------------------------ -To install and run a prebuilt version of this example, enter -the following command in the ServiceMix console: - - features:install examples-cxf-ws-security-signature - -This command makes use of the ServiceMix features facility. For -more information about the features facility, see the README.txt -file in the examples parent directory. - -To view the service WSDL, open your browser and go to the following -URL: - - http://localhost:8181/cxf/HelloWorldSecurity?wsdl - -Note, if you use Safari, right click the window and select -'Show Source'. - -Running a Client ----------------- -To run the java code client: - -1. Change to the <servicemix_home>/examples/cxf/cxf-ws-security-signature - directory. - -2. Run the following command: - - mvn compile exec:java - - If the client request is successful, - it will print out - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:sayHelloResponse xmlns:ns2="http://cxf.apache.org/wsse/handler/helloworld"><return>Hello CXF</return></ns2:sayHelloResponse></soap:Body></soap:Envelope> - - -Changing /cxf servlet alias ---------------------------- -By default CXF Servlet is assigned a '/cxf' alias. You can -change it in a couple of ways - -a. Add org.apache.cxf.osgi.cfg to the /etc directory and set - the 'org.apache.cxf.servlet.context' property, for example: - - org.apache.cxf.servlet.context=/custom - -b. Use shell config commands, for example : - - config:edit org.apache.cxf.osgi - config:propset org.apache.cxf.servlet.context /super - config:update - - -B. Building the Example Bundle Yourself ---------------------------------------- -To install and run the example where you build the example bundle -yourself, complete the following steps: - -1. If you have already run the example using the prebuilt version as - described above, you must first uninstall the examples-cxf-ws-security-signature - feature by entering the following command in the ServiceMix console: - - features:uninstall examples-cxf-ws-security-signature - - -2. Build the example by opening a command prompt, changing directory to - examples/cxf-ws-security-signature (this example) and entering the following Maven - command: - - mvn install - - If all of the required OSGi bundles are available in your local - Maven repository, the example will build very quickly. Otherwise - it may take some time for Maven to download everything it needs. - - The mvn install command builds the example deployment bundle and - copies it to your local Maven repository and to the target directory - of this example. - -3. Install the example by entering the following command in - the ServiceMix console: - - features:install examples-cxf-ws-security-signature - - It makes use of the ServiceMix features facility. For more - information about the features facility, see the README.txt file - in the examples parent directory. - -To view the service WSDL, open your browser and go to the following -URL: - - http://localhost:8181/cxf/HelloWorldSecurity?wsdl - -Note, if you use Safari, right click the window and select -'Show Source'. - -You can try running a client against your service by following the -instructions in the "Running a Client" section above. - - -Stopping and Uninstalling the Example -------------------------------------- -To stop the example, you must first know the bundle ID that ServiceMix -has assigned to it. To get the bundle ID, enter the following command -at the ServiceMix console: - - osgi:list - -At the end of the listing, you should see an entry similar to the -following: - - [170] [Active ] [Started] [ 60] Apache ServiceMix Example :: CXF WS SECURITY OSGI (4.2.0.0) - -In this case, the bundle ID is 170. - -To stop the example, enter the following command at the ServiceMix -console: - - osgi:stop <bundle_id> - -For example: - - osgi:stop 170 - -To uninstall the example, enter one of the following commands in -the ServiceMix console: - - features:uninstall examples-cxf-ws-security-signature - -or - - osgi:uninstall <bundle_id> - - -Viewing the Log Entries ------------------------ -You can view the entries in the log file in the data/log -directory of your ServiceMix installation, or by typing -the following command in the ServiceMix console: - - log:display http://git-wip-us.apache.org/repos/asf/servicemix-features/blob/d358d2ea/examples/cxf/cxf-ws-security-signature/pom.xml ---------------------------------------------------------------------- diff --git a/examples/cxf/cxf-ws-security-signature/pom.xml b/examples/cxf/cxf-ws-security-signature/pom.xml deleted file mode 100644 index c32d892..0000000 --- a/examples/cxf/cxf-ws-security-signature/pom.xml +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <!-- - - 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. - --> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.servicemix.examples</groupId> - <artifactId>cxf</artifactId> - <version>4.6.0-SNAPSHOT</version> - </parent> - - <artifactId>cxf-ws-security-signature</artifactId> - <packaging>bundle</packaging> - <name>Apache ServiceMix :: Features :: Examples :: CXF WS-Security Signature OSGi</name> - <description>CXF example using WS-Security Signature Action</description> - - <dependencies> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-ws-metadata_2.0_spec</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicemix</groupId> - <artifactId>servicemix-utils</artifactId> - </dependency> - <dependency> - <groupId>org.apache.ws.security</groupId> - <artifactId>wss4j</artifactId> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <configuration> - <instructions> - <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> - <Bundle-Description>${project.description}</Bundle-Description> - <Import-Package> - javax.jws, - javax.xml.bind.annotation, - javax.xml.namespace, - javax.wsdl, - META-INF.cxf, - META-INF.cxf.osgi, - org.apache.cxf.bus, - org.apache.cxf.bus.spring, - org.apache.cxf.bus.resource, - org.apache.cxf.configuration.spring, - org.apache.cxf.resource, - org.apache.cxf.transport.http, - org.apache.cxf.ws.security.wss4j, - org.springframework.beans.factory.config, - javax.security.auth.callback, - org.apache.ws.security, - org.apache.servicemix.util, - org.apache.ws.security.processor, - org.apache.cxf.binding.soap.saaj - </Import-Package> - <Export-Package>org.apache.servicemix.examples.cxf</Export-Package> - <Require-Bundle>org.apache.cxf.bundle</Require-Bundle> - </instructions> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <configuration> - <mainClass>org.apache.servicemix.examples.cxf.Client</mainClass> - <includePluginDependencies>false</includePluginDependencies> - </configuration> - </plugin> - </plugins> - </build> - -</project>
