sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1232400 - in /sling/trunk/bundles/auth/core/src: main/java/org/apache/sling/auth/core/AuthUtil.java test/java/org/apache/sling/auth/core/AuthUtilTest.java
Date Tue, 17 Jan 2012 12:52:33 GMT
Author: fmeschbe
Date: Tue Jan 17 12:52:33 2012
New Revision: 1232400

URL: http://svn.apache.org/viewvc?rev=1232400&view=rev
Log:
SLING-2360 Ensure requesting the serlvet context root path does not fail

Modified:
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthUtil.java
    sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/AuthUtilTest.java

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthUtil.java?rev=1232400&r1=1232399&r2=1232400&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthUtil.java (original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthUtil.java Tue
Jan 17 12:52:33 2012
@@ -481,6 +481,11 @@ public final class AuthUtil {
             return false;
         }
 
+        // special case of requesting the servlet context root path
+        if (ctxPath.length() == target.length()) {
+            return true;
+        }
+
         final String localTarget = target.substring(ctxPath.length());
         if (!localTarget.startsWith("/")) {
             getLog().warn(

Modified: sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/AuthUtilTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/AuthUtilTest.java?rev=1232400&r1=1232399&r2=1232400&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/AuthUtilTest.java
(original)
+++ sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/AuthUtilTest.java
Tue Jan 17 12:52:33 2012
@@ -98,6 +98,7 @@ public class AuthUtilTest {
 
         TestCase.assertFalse(AuthUtil.isRedirectValid(request, "relative/path"));
         TestCase.assertTrue(AuthUtil.isRedirectValid(request, "/absolute/path"));
+        TestCase.assertTrue(AuthUtil.isRedirectValid(request, "/"));
     }
 
     @Test
@@ -116,6 +117,9 @@ public class AuthUtilTest {
 
         TestCase.assertFalse(AuthUtil.isRedirectValid(request, "ctx/relative/path"));
         TestCase.assertTrue(AuthUtil.isRedirectValid(request, "/ctx/absolute/path"));
+
+        TestCase.assertTrue(AuthUtil.isRedirectValid(request, "/ctx/"));
+        TestCase.assertTrue(AuthUtil.isRedirectValid(request, "/ctx"));
     }
 
     @Test



Mime
View raw message