Author: fmeschbe
Date: Wed Nov  5 14:17:42 2008
New Revision: 711721

URL: http://svn.apache.org/viewvc?rev=711721&view=rev
Log:
SLING-722 Assume the root path if HttpServletRequest.getPathInfo() returns null

Modified:
    
incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java

Modified: 
incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java?rev=711721&r1=711720&r2=711721&view=diff
==============================================================================
--- 
incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
 (original)
+++ 
incubator/sling/trunk/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
 Wed Nov  5 14:17:42 2008
@@ -362,9 +362,18 @@
 
     private AuthenticationInfo getAuthenticationInfo(
             HttpServletRequest request, HttpServletResponse response) {
+
+        // Get the path used to select the authenticator, if the SlingServlet
+        // itself has been requested without any more info, this will be null
+        // and we assume the root (SLING-722)
+        String pathInfo = request.getPathInfo();
+        if (pathInfo == null || pathInfo.length() == 0) {
+            pathInfo = "/";
+        }
+        
         AuthenticationHandlerInfo[] local = getAuthenticationHandlers();
         for (int i = 0; i < local.length; i++) {
-            if ( request.getPathInfo().startsWith(local[i].path) ) {
+            if ( pathInfo.startsWith(local[i].path) ) {
                 final AuthenticationInfo authInfo = 
local[i].handler.authenticate(request,
                     response);
                 if (authInfo != null) {


Reply via email to