cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r795044 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/common/util/ systests/src/test/java/org/apache/cxf/systest/jaxrs/security/ systests/src/test/resources/jaxrs_security/WEB-INF/ systests/src/test/resources/jaxrs_security_cg...
Date Fri, 17 Jul 2009 11:22:29 GMT
Author: sergeyb
Date: Fri Jul 17 11:22:28 2009
New Revision: 795044

URL: http://svn.apache.org/viewvc?rev=795044&view=rev
Log:
[CXF-2345] Fixing SpringAopClassHelper to recognize double CGLIB proxies

Added:
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBook.java
  (with props)
Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
    cxf/trunk/systests/src/test/resources/jaxrs_security/WEB-INF/beans.xml
    cxf/trunk/systests/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java?rev=795044&r1=795043&r2=795044&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SpringAopClassHelper.java
Fri Jul 17 11:22:28 2009
@@ -46,7 +46,9 @@
                 // ignore
             }
             
-        } 
+        } else if (AopUtils.isCglibProxyClass(o.getClass())) {
+            return AopUtils.getTargetClass(o);
+        }
         return o.getClass();
     }
     

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java?rev=795044&r1=795043&r2=795044&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
Fri Jul 17 11:22:28 2009
@@ -62,5 +62,13 @@
         getBook(endpointAddress, "bob", "bobspassword", 403);
     }
     
+    @Test
+    public void testGetBookSubresourceAdmin() throws Exception {
+        String endpointAddress =
+            "http://localhost:9080/bookstorestorage/securebook/self"; 
+        getBook(endpointAddress, "foo", "bar", 200); 
+        getBook(endpointAddress, "bob", "bobspassword", 403);
+    }
+    
       
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java?rev=795044&r1=795043&r2=795044&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java
Fri Jul 17 11:22:28 2009
@@ -120,4 +120,12 @@
         assertEquals(expectedStatus, r.getStatus());
             
     }
+    
+    @Test
+    public void testGetBookSubresourceAdmin() throws Exception {
+        String endpointAddress =
+            "http://localhost:9080/bookstorestorage/securebook/self"; 
+        getBook(endpointAddress, "foo", "bar", 200); 
+        getBook(endpointAddress, "bob", "bobspassword", 403);
+    }
 }

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBook.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBook.java?rev=795044&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBook.java
(added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBook.java
Fri Jul 17 11:22:28 2009
@@ -0,0 +1,66 @@
+/**
+ * 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.jaxrs.security;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.apache.cxf.systest.jaxrs.Book;
+import org.springframework.security.annotation.Secured;
+
+public class SecureBook {
+    private String name;
+    private long id;
+    
+    public SecureBook() {
+        name = "CXF in Action";
+        id = 123L;
+    }
+    
+    public SecureBook(String name, long id) {
+        this.name = name;
+        this.id = id;
+    }
+    
+    public void setName(String n) {
+        name = n;
+    }
+
+    public String getName() {
+        return name;
+    }
+    
+    public void setId(long i) {
+        id = i;
+    }
+    public long getId() {
+        return id;
+    }
+    
+    @GET
+    @Path("self")    
+    @Produces("application/xml")
+    @Secured("ROLE_ADMIN")
+    public Book getBook() {
+        return new Book(name, id);
+    } 
+    
+}

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBook.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBook.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java?rev=795044&r1=795043&r2=795044&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookInterface.java
Fri Jul 17 11:22:28 2009
@@ -56,4 +56,7 @@
     @Produces("application/xml")
     @Secured("ROLE_ADMIN")
     Book getDefaultBook() throws BookNotFoundFault;
+    
+    @Path("/securebook")
+    SecureBook getSecureBook() throws BookNotFoundFault;
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java?rev=795044&r1=795043&r2=795044&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStore.java
Fri Jul 17 11:22:28 2009
@@ -80,4 +80,9 @@
     public Book getDefaultBook() throws BookNotFoundFault {
         return books.get(123L);
     }
+    
+    @Path("/securebook")
+    public SecureBook getSecureBook() throws BookNotFoundFault {
+        return new SecureBook("CXF in Action", 123L);
+    }
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java?rev=795044&r1=795043&r2=795044&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/security/SecureBookStoreNoInterface.java
Fri Jul 17 11:22:28 2009
@@ -68,4 +68,9 @@
     public Book getThatBook() throws BookNotFoundFault {
         return books.get(123L);
     }
+    
+    @Path("/securebook")
+    public SecureBook getSecureBook() throws BookNotFoundFault {
+        return new SecureBook("CXF in Action", 123L);
+    }
 }

Modified: cxf/trunk/systests/src/test/resources/jaxrs_security/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/jaxrs_security/WEB-INF/beans.xml?rev=795044&r1=795043&r2=795044&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/jaxrs_security/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/src/test/resources/jaxrs_security/WEB-INF/beans.xml Fri Jul 17 11:22:28
2009
@@ -59,8 +59,11 @@
 
   <bean id="bookstore" class="org.apache.cxf.systest.jaxrs.security.SecureBookStore">
      <property name="bookStore" ref="bookstore2"/>
+     <lookup-method name="getSecureBook" bean="subResource" />
   </bean>
   
+  <bean id="subResource" class="org.apache.cxf.systest.jaxrs.security.SecureBook"/>
 
+  
   <bean id="bookstore2" class="org.apache.cxf.systest.jaxrs.security.SecureBookStore"/>
 
   <security:global-method-security secured-annotations="enabled"/>

Modified: cxf/trunk/systests/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml?rev=795044&r1=795043&r2=795044&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/src/test/resources/jaxrs_security_cglib/WEB-INF/beans.xml Fri Jul 17
11:22:28 2009
@@ -53,7 +53,12 @@
     </jaxrs:providers>
   </jaxrs:server>
 
-  <bean id="bookstore" class="org.apache.cxf.systest.jaxrs.security.SecureBookStoreNoInterface"/>
+  <bean id="bookstore" class="org.apache.cxf.systest.jaxrs.security.SecureBookStoreNoInterface">
+      <lookup-method name="getSecureBook" bean="subResource" />
+  </bean>
+  
+  <bean id="subResource" class="org.apache.cxf.systest.jaxrs.security.SecureBook"/>
+  
   <aop:config proxy-target-class="true"/>
   
   <security:global-method-security secured-annotations="enabled"/>



Mime
View raw message