cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r920067 - in /cxf/sandbox/veithen/cxf-spring-security: cxf-systests-spring-security/ cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/ cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method...
Date Sun, 07 Mar 2010 19:36:38 GMT
Author: veithen
Date: Sun Mar  7 19:36:38 2010
New Revision: 920067

URL: http://svn.apache.org/viewvc?rev=920067&view=rev
Log:
Converted JAX-RS sample to systest.

Added:
    cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/GreeterService.java
      - copied, changed from r918166, cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/java/sample/GreeterService.java
    cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/HttpAuthJaxrsMethodSecurityTest.java
  (with props)
    cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/
    cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/
    cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/beans.xml
      - copied, changed from r919199, cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/webapp/WEB-INF/applicationContext.xml
    cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/web.xml
      - copied, changed from r918166, cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/webapp/WEB-INF/web.xml
Removed:
    cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/
Modified:
    cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml
    cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml

Modified: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml?rev=920067&r1=920066&r2=920067&view=diff
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml (original)
+++ cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/pom.xml Sun Mar 
7 19:36:38 2010
@@ -43,6 +43,12 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-core-tiger</artifactId>
+            <version>2.0.4</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
@@ -79,6 +85,18 @@
             <version>${spring.version}</version>
             <scope>test</scope>
         </dependency>
+        <!-- This is required for <security:global-method-security> -->
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjrt</artifactId>
+            <version>1.6.4</version>
+        </dependency>
+        <!-- Allow Spring to create proxies for classes that are not specified by interface
-->
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib-nodep</artifactId>
+            <version>2.1_3</version>
+        </dependency>
         
         <!-- Dependencies for JMS -->
         <dependency>

Copied: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/GreeterService.java
(from r918166, cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/java/sample/GreeterService.java)
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/GreeterService.java?p2=cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/GreeterService.java&p1=cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/java/sample/GreeterService.java&r1=918166&r2=920067&rev=920067&view=diff
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/java/sample/GreeterService.java
(original)
+++ cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/GreeterService.java
Sun Mar  7 19:36:38 2010
@@ -1,4 +1,22 @@
-package sample;
+/**
+ * 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.cxf.systest.security;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;

Added: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/HttpAuthJaxrsMethodSecurityTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/HttpAuthJaxrsMethodSecurityTest.java?rev=920067&view=auto
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/HttpAuthJaxrsMethodSecurityTest.java
(added)
+++ cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/HttpAuthJaxrsMethodSecurityTest.java
Sun Mar  7 19:36:38 2010
@@ -0,0 +1,70 @@
+/**
+ * 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.cxf.systest.security;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class HttpAuthJaxrsMethodSecurityTest extends AbstractClientServerTestBase {
+    public static class SpringServer extends AbstractSpringServer {
+        public SpringServer() {
+            super("/security_http_auth_jaxrs_method_security");
+        }
+        
+        public static void main(String args[]) {
+            try {
+                SpringServer s = new SpringServer();
+                s.start();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                System.exit(-1);
+            } finally {
+                System.out.println("done!");
+            }
+        }
+    }
+    
+    @BeforeClass
+    public static void beforeClass() throws Exception {
+        assertTrue(launchServer(SpringServer.class));
+    }
+    
+    @Test
+    public void testUnauthenticated() {
+        WebClient client = WebClient.create("http://localhost:9080/rest/greeting");
+        assertEquals(401, client.get().getStatus());
+    }
+    
+    @Test
+    public void testUnauthorized() {
+        WebClient client = WebClient.create("http://localhost:9080/rest/greeting", "bob",
"password", null);
+        client.header("Content-Type", "text/plain").put("test");
+        assertEquals(403, client.getResponse().getStatus());
+    }
+    
+    @Test
+    public void testSecurityContext() {
+        WebClient client = WebClient.create("http://localhost:9080/rest/greeting", "joe",
"password", null);
+        assertEquals("Hello joe!", client.accept("text/plain").get(String.class));
+    }
+}

Propchange: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/java/org/apache/cxf/systest/security/HttpAuthJaxrsMethodSecurityTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/beans.xml
(from r919199, cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/webapp/WEB-INF/applicationContext.xml)
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/beans.xml?p2=cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/beans.xml&p1=cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/webapp/WEB-INF/applicationContext.xml&r1=919199&r2=920067&rev=920067&view=diff
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/webapp/WEB-INF/applicationContext.xml
(original)
+++ cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/beans.xml
Sun Mar  7 19:36:38 2010
@@ -1,4 +1,22 @@
 <?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.
+-->
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:security="http://www.springframework.org/schema/security"
        xmlns:ssec="http://cxf.apache.org/spring-security"
@@ -25,7 +43,7 @@
     
     <jaxrs:server address="/rest">
         <jaxrs:serviceBeans>
-            <bean class="sample.GreeterService"/>
+            <bean class="org.apache.cxf.systest.security.GreeterService"/>
         </jaxrs:serviceBeans>
         <jaxrs:providers>
             <bean class="org.apache.cxf.security.spring.SpringSecurityExceptionMapper"/>

Copied: cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/web.xml
(from r918166, cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/webapp/WEB-INF/web.xml)
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/web.xml?p2=cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/web.xml&p1=cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/webapp/WEB-INF/web.xml&r1=918166&r2=920067&rev=920067&view=diff
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/samples/jax-rs/src/main/webapp/WEB-INF/web.xml
(original)
+++ cxf/sandbox/veithen/cxf-spring-security/cxf-systests-spring-security/src/test/resources/security_http_auth_jaxrs_method_security/WEB-INF/web.xml
Sun Mar  7 19:36:38 2010
@@ -1,8 +1,30 @@
 <?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.
+-->
 <web-app version="2.4"
          xmlns="http://java.sun.com/xml/ns/j2ee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>WEB-INF/beans.xml</param-value>
+    </context-param>
     <listener>
         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener>

Modified: cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml?rev=920067&r1=920066&r2=920067&view=diff
==============================================================================
--- cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml (original)
+++ cxf/sandbox/veithen/cxf-spring-security/samples/pom.xml Sun Mar  7 19:36:38 2010
@@ -15,7 +15,6 @@
     </properties>
     
     <modules>
-        <module>jax-rs</module>
         <module>wss</module>
     </modules>
     
@@ -124,4 +123,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>



Mime
View raw message