geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r614454 - in /geronimo/specs/trunk/geronimo-jacc_1.1_spec: ./ src/main/java/javax/security/jacc/ src/test/java/javax/security/jacc/
Date Wed, 23 Jan 2008 08:45:39 GMT
Author: djencks
Date: Wed Jan 23 00:45:36 2008
New Revision: 614454

URL: http://svn.apache.org/viewvc?rev=614454&view=rev
Log:
GERONIMO-3776 assure permission name matches string used in implies calculations for web permissions.
 Also clean up pom

Modified:
    geronimo/specs/trunk/geronimo-jacc_1.1_spec/pom.xml
    geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebResourcePermission.java
    geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebUserDataPermission.java
    geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/MockHttpServletRequest.java
    geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebResourcePermissionTest.java
    geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebUserDataPermissionTest.java

Modified: geronimo/specs/trunk/geronimo-jacc_1.1_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jacc_1.1_spec/pom.xml?rev=614454&r1=614453&r2=614454&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jacc_1.1_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-jacc_1.1_spec/pom.xml Wed Jan 23 00:45:36 2008
@@ -27,8 +27,7 @@
     <parent>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>specs</artifactId>
-        <version>1.3-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
+        <version>1.3</version>
     </parent>
 
     <artifactId>geronimo-jacc_1.1_spec</artifactId>
@@ -37,9 +36,9 @@
     <version>1.0.1-SNAPSHOT</version>
 
     <properties>
-	    <geronimo.osgi.export.pkg>javax.security.jacc*</geronimo.osgi.export.pkg>
+        <geronimo.osgi.export.pkg>javax.security.jacc*</geronimo.osgi.export.pkg>
         <geronimo.osgi.export.version>1.1</geronimo.osgi.export.version>
-	</properties>
+    </properties>
 
     <scm>
         <connection>scm:svn:https://svn.apache.org/repos/asf/geronimo/specs/trunk/geronimo-jacc_1.1_spec</connection>
@@ -51,7 +50,7 @@
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-servlet_2.5_spec</artifactId>
-		    <version>1.1.1-SNAPSHOT</version>
+            <version>1.1.1</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

Modified: geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebResourcePermission.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebResourcePermission.java?rev=614454&r1=614453&r2=614454&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebResourcePermission.java
(original)
+++ geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebResourcePermission.java
Wed Jan 23 00:45:36 2008
@@ -44,9 +44,9 @@
     private transient HTTPMethodSpec httpMethodSpec;
 
     public WebResourcePermission(HttpServletRequest request) {
-        super(request.getServletPath());
+        super(URLPatternSpec.encodeColons(request));
 
-        urlPatternSpec = new URLPatternSpec(URLPatternSpec.encodeColons(request));
+        urlPatternSpec = new URLPatternSpec(getName());
         httpMethodSpec = new HTTPMethodSpec(request.getMethod(), HTTPMethodSpec.NA);
     }
 

Modified: geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebUserDataPermission.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebUserDataPermission.java?rev=614454&r1=614453&r2=614454&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebUserDataPermission.java
(original)
+++ geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/main/java/javax/security/jacc/WebUserDataPermission.java
Wed Jan 23 00:45:36 2008
@@ -67,9 +67,9 @@
      *                by calling HttpServletRequest.isSecure().
      */
     public WebUserDataPermission(HttpServletRequest request) {
-        super(request.getServletPath());
+        super(URLPatternSpec.encodeColons(request));
 
-        urlPatternSpec = new URLPatternSpec(URLPatternSpec.encodeColons(request));
+        urlPatternSpec = new URLPatternSpec(getName());
         httpMethodSpec = new HTTPMethodSpec(request.getMethod(), request.isSecure()? HTTPMethodSpec.CONFIDENTIAL:
HTTPMethodSpec.NONE);
     }
 

Modified: geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/MockHttpServletRequest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/MockHttpServletRequest.java?rev=614454&r1=614453&r2=614454&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/MockHttpServletRequest.java
(original)
+++ geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/MockHttpServletRequest.java
Wed Jan 23 00:45:36 2008
@@ -39,10 +39,18 @@
 
     private final String servletPath;
     private final String pathInfo;
+    private final String method;
 
     public MockHttpServletRequest(String servletPath, String pathInfo) {
         this.servletPath = servletPath;
         this.pathInfo = pathInfo;
+        this.method = "GET";
+    }
+
+    public MockHttpServletRequest(String servletPath, String pathInfo, String method) {
+        this.servletPath = servletPath;
+        this.pathInfo = pathInfo;
+        this.method = method;
     }
 
     public String getAuthType() {
@@ -74,7 +82,7 @@
     }
 
     public String getMethod() {
-        return null;
+        return method;
     }
 
     public String getPathInfo() {

Modified: geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebResourcePermissionTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebResourcePermissionTest.java?rev=614454&r1=614453&r2=614454&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebResourcePermissionTest.java
(original)
+++ geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebResourcePermissionTest.java
Wed Jan 23 00:45:36 2008
@@ -31,6 +31,8 @@
 import java.io.ByteArrayInputStream;
 import java.io.ObjectInputStream;
 
+import javax.servlet.http.HttpServletRequest;
+
 import junit.framework.TestCase;
 
 /**
@@ -375,6 +377,21 @@
      * Testing WebResourcePermission(HttpServletRequest)
      */
     public void testConstructorHttpServletRequest() {
+        Permission p = new WebResourcePermission(new MockHttpServletRequest("/foo", "", "GET"));
+        checkPermission(p, "/foo", "GET");
+        p = new WebResourcePermission(new MockHttpServletRequest("", "/foo", "GET"));
+        checkPermission(p, "/foo", "GET");
+        p = new WebResourcePermission(new MockHttpServletRequest("/foo", "/foo", "BAR"));
+        checkPermission(p, "/foo/foo", "BAR");
+        p = new WebResourcePermission(new MockHttpServletRequest("/foo", "/foo:bar", "BAR"));
+        checkPermission(p, "/foo/foo%3Abar", "BAR");
+        p = new WebResourcePermission(new MockHttpServletRequest("/foo", "/foo%3Abar", "BAR"));
+        checkPermission(p, "/foo/foo%3A%3Abar", "BAR");
+    }
+
+    private void checkPermission(Permission p, String name, String actions) {
+        assertEquals(p.getName(), name);
+        assertEquals(p.getActions(), actions);
     }
 
     public void testImpliesHttpServletRequest() {

Modified: geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebUserDataPermissionTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebUserDataPermissionTest.java?rev=614454&r1=614453&r2=614454&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebUserDataPermissionTest.java
(original)
+++ geronimo/specs/trunk/geronimo-jacc_1.1_spec/src/test/java/javax/security/jacc/WebUserDataPermissionTest.java
Wed Jan 23 00:45:36 2008
@@ -30,6 +30,7 @@
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.security.Permission;
 
 import junit.framework.TestCase;
 
@@ -119,6 +120,21 @@
      * Testing WebResourcePermission(HttpServletRequest)
      */
     public void testConstructorHttpServletRequest() {
+        Permission p = new WebUserDataPermission(new MockHttpServletRequest("/foo", "", "GET"));
+        checkPermission(p, "/foo", "GET");
+        p = new WebUserDataPermission(new MockHttpServletRequest("", "/foo", "GET"));
+        checkPermission(p, "/foo", "GET");
+        p = new WebUserDataPermission(new MockHttpServletRequest("/foo", "/foo", "BAR"));
+        checkPermission(p, "/foo/foo", "BAR");
+        p = new WebUserDataPermission(new MockHttpServletRequest("/foo", "/foo:bar", "BAR"));
+        checkPermission(p, "/foo/foo%3Abar", "BAR");
+        p = new WebUserDataPermission(new MockHttpServletRequest("/foo", "/foo%3Abar", "BAR"));
+        checkPermission(p, "/foo/foo%3A%3Abar", "BAR");
+    }
+
+    private void checkPermission(Permission p, String name, String actions) {
+        assertEquals(p.getName(), name);
+        assertEquals(p.getActions(), actions);
     }
 
     public void testImpliesHttpServletRequest() {



Mime
View raw message