incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r791120 - /sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
Date Sat, 04 Jul 2009 13:07:20 GMT
Author: fmeschbe
Date: Sat Jul  4 13:07:18 2009
New Revision: 791120

URL: http://svn.apache.org/viewvc?rev=791120&view=rev
Log:
SLING-1032 Directly call the login method when anonymous access
is not allowed by configuration

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

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java?rev=791120&r1=791119&r2=791120&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
Sat Jul  4 13:07:18 2009
@@ -254,7 +254,7 @@
         if (response.isCommitted()) {
             throw new IllegalStateException("Response already committed");
         }
-        
+
         AuthenticationHandlerInfo[] handlerInfos = findApplicableAuthenticationHandlers(request);
         boolean done = false;
         for (int i = 0; !done && i < handlerInfos.length; i++) {
@@ -499,8 +499,8 @@
     private boolean getAnonymousSession(HttpServletRequest req,
             HttpServletResponse res) throws MissingRepositoryException {
 
-        final boolean isLoginPath = LoginServlet.LOGIN_SERVLET_PATH.equals(req.getPathInfo());

-          
+        final boolean isLoginPath = LoginServlet.LOGIN_SERVLET_PATH.equals(req.getPathInfo());
+
         // Get an anonymous session if allowed, or if we are handling
         // a request for the login servlet
         if (this.anonymousAllowed || isLoginPath) {
@@ -513,16 +513,12 @@
                 handleLoginFailure(req, res, re);
                 return false;
             }
-        } 
+        }
 
         // If we get here, anonymous access is not allowed: redirect
         // to the login servlet
-        log.debug("getAnonymousSession: Anonymous access not allowed by configuration - redirecting
to login form");
-        try {
-          res.sendRedirect(req.getContextPath() + LoginServlet.LOGIN_SERVLET_PATH);
-        } catch(IOException ioe) {
-          handleLoginFailure(req, res, ioe);
-        }
+        log.info("getAnonymousSession: Anonymous access not allowed by configuration - redirecting
to login");
+        login(req, res);
 
         // fallback to no session
         return false;



Mime
View raw message