Author: fmeschbe
Date: Thu Sep 9 17:37:40 2010
New Revision: 995511
URL: http://svn.apache.org/viewvc?rev=995511&view=rev
Log:
SLING-1742 Just set the status to send back the 401 response instead of using
sendError
Modified:
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/HttpBasicAuthenticationHandler.java
Modified:
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/HttpBasicAuthenticationHandler.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/HttpBasicAuthenticationHandler.java?rev=995511&r1=995510&r2=995511&view=diff
==============================================================================
---
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/HttpBasicAuthenticationHandler.java
(original)
+++
sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/HttpBasicAuthenticationHandler.java
Thu Sep 9 17:37:40 2010
@@ -232,11 +232,16 @@ class HttpBasicAuthenticationHandler ext
} else {
+ response.resetBuffer();
+
+ // just set the status because this may be called as part of an
+ // error handler in which case sendError would result in an error
+ // handler loop and thus be ignored.
+ response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setHeader(HEADER_WWW_AUTHENTICATE,
AUTHENTICATION_SCHEME_BASIC + " realm=\"" + this.realm + "\"");
try {
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
response.flushBuffer();
return true;
} catch (IOException ioe) {