You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2009/07/04 15:07:20 UTC
svn commit: r791120 -
/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/auth/SlingAuthenticator.java
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;