You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@tomee.apache.org by bu...@apache.org on 2012/08/16 23:53:00 UTC
svn commit: r829138 - in /websites/staging/openejb/trunk: cgi-bin/ content/
content/examples-trunk/
content/examples-trunk/webservice-ws-with-resources-config/
content/examples-trunk/webservice-ws-with-resources-config/src/
content/examples-trunk/webse...
Author: buildbot
Date: Thu Aug 16 21:52:59 2012
New Revision: 829138
Log:
Staging update by buildbot for openejb
Added:
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/pom.xml (with props)
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/Calculator.java
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/CalculatorBean.java
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/PasswordCallbackHandler.java
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/resources/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/resources/META-INF/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/resources/META-INF/resources.xml (with props)
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/java/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/java/org/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/java/org/superbiz/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/java/org/superbiz/ws/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/java/org/superbiz/ws/security/
websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/java/org/superbiz/ws/security/CalculatorTest.java
Modified:
websites/staging/openejb/trunk/cgi-bin/ (props changed)
websites/staging/openejb/trunk/content/ (props changed)
websites/staging/openejb/trunk/content/examples-trunk/pom.xml
Propchange: websites/staging/openejb/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Aug 16 21:52:59 2012
@@ -1 +1 @@
-1373938
+1374076
Propchange: websites/staging/openejb/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Aug 16 21:52:59 2012
@@ -1 +1 @@
-1373938
+1374076
Modified: websites/staging/openejb/trunk/content/examples-trunk/pom.xml
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/pom.xml (original)
+++ websites/staging/openejb/trunk/content/examples-trunk/pom.xml Thu Aug 16 21:52:59 2012
@@ -17,7 +17,7 @@
limitations under the License.
-->
<!--test 2-->
-<!-- $Rev: 1372693 $ $Date: 2012-08-14 01:06:05 +0000 (Tue, 14 Aug 2012) $ -->
+<!-- $Rev: 1374076 $ $Date: 2012-08-16 21:52:48 +0000 (Thu, 16 Aug 2012) $ -->
<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">
<parent>
@@ -133,6 +133,7 @@
<module>webservice-inheritance</module>
<module>webservice-security</module>
<module>webservice-ws-security</module>
+ <module>webservice-ws-with-resources-config</module>
<module>webservice-handlerchain</module>
<module>webservice-holder</module>
</modules>
Added: websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/pom.xml
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/pom.xml
------------------------------------------------------------------------------
svn:mime-type = application/xml
Added: websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/Calculator.java
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/Calculator.java (added)
+++ websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/Calculator.java Thu Aug 16 21:52:59 2012
@@ -0,0 +1,24 @@
+/**
+ * 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.superbiz.ws.security;
+
+import javax.jws.WebService;
+
+@WebService
+public interface Calculator {
+ int add(int op1, int op2);
+}
Added: websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/CalculatorBean.java
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/CalculatorBean.java (added)
+++ websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/CalculatorBean.java Thu Aug 16 21:52:59 2012
@@ -0,0 +1,29 @@
+/**
+ * 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.superbiz.ws.security;
+
+import javax.ejb.Singleton;
+import javax.jws.WebService;
+
+@Singleton
+@WebService
+public class CalculatorBean implements Calculator {
+ @Override
+ public int add(int op1, int op2) {
+ return op1 + op2;
+ }
+}
Added: websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/PasswordCallbackHandler.java
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/PasswordCallbackHandler.java (added)
+++ websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/java/org/superbiz/ws/security/PasswordCallbackHandler.java Thu Aug 16 21:52:59 2012
@@ -0,0 +1,34 @@
+/**
+ * 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.superbiz.ws.security;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import java.io.IOException;
+
+public class PasswordCallbackHandler implements CallbackHandler {
+ @Override
+ public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
+ if (pc.getIdentifier().equals("openejb")) {
+ pc.setPassword("tomee");
+ }
+ }
+}
Added: websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/resources/META-INF/resources.xml
==============================================================================
Binary file - no diff available.
Propchange: websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/main/resources/META-INF/resources.xml
------------------------------------------------------------------------------
svn:mime-type = application/xml
Added: websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/java/org/superbiz/ws/security/CalculatorTest.java
==============================================================================
--- websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/java/org/superbiz/ws/security/CalculatorTest.java (added)
+++ websites/staging/openejb/trunk/content/examples-trunk/webservice-ws-with-resources-config/src/test/java/org/superbiz/ws/security/CalculatorTest.java Thu Aug 16 21:52:59 2012
@@ -0,0 +1,97 @@
+/**
+ * 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.superbiz.ws.security;
+
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
+import org.apache.openejb.OpenEjbContainer;
+import org.apache.ws.security.WSPasswordCallback;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPFaultException;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.matchers.JUnitMatchers.containsString;
+
+public class CalculatorTest {
+ @Test
+ public void call() throws MalformedURLException {
+ final EJBContainer container = EJBContainer.createEJBContainer(new Properties() {{
+ setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true");
+ }});
+
+ // normal call
+
+ final Service service = Service.create(
+ new URL("http://127.0.0.1:4204/webservice-ws-with-resources-config/CalculatorBean?wsdl"),
+ new QName("http://security.ws.superbiz.org/", "CalculatorBeanService"));
+
+ final Calculator calculator = service.getPort(Calculator.class);
+ ClientProxy.getClient(calculator).getOutInterceptors().add(
+ new WSS4JOutInterceptor(new HashMap<String, Object>() {{
+ put("action", "UsernameToken");
+ put("user", "openejb");
+ put("passwordType", "PasswordText");
+ put("passwordCallbackRef", new CallbackHandler() {
+ @Override
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
+ pc.setPassword("tomee");
+ }
+ });
+ }}));
+
+ assertEquals(5, calculator.add(2, 3));
+
+ // bad auth
+
+ final Calculator calculator2 = service.getPort(Calculator.class);
+ ClientProxy.getClient(calculator2).getOutInterceptors().add(
+ new WSS4JOutInterceptor(new HashMap<String, Object>() {{
+ put("action", "UsernameToken");
+ put("user", "openejb");
+ put("passwordType", "PasswordText");
+ put("passwordCallbackRef", new CallbackHandler() {
+ @Override
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
+ pc.setPassword("wrong");
+ }
+ });
+ }}));
+
+ try {
+ assertEquals(5, calculator2.add(2, 3));
+ } catch (SOAPFaultException sfe) {
+ assertThat(sfe.getMessage(), containsString("The security token could not be authenticated or authorized"));
+ }
+
+ container.close();
+ }
+}