indent, javadoc and removed unused import

This commit is contained in:
Sebastian Sdorra
2014-03-11 18:59:59 +01:00
parent 7c1f746def
commit 27f3286e9d

View File

@@ -35,7 +35,6 @@ package sonia.scm.web.filter;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Strings;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
@@ -85,6 +84,7 @@ public class BasicAuthenticationFilter extends AutoLoginFilter
/** Field description */
public static final String HEADER_AUTHORIZATION = "Authorization";
/** marker for failed authentication */
private static final String ATTRIBUTE_FAILED_AUTH = "sonia.scm.auth.failed";
/** the logger for BasicAuthenticationFilter */
@@ -213,6 +213,7 @@ public class BasicAuthenticationFilter extends AutoLoginFilter
HttpServletResponse response, FilterChain chain)
throws IOException, ServletException
{
// send only forbidden, if the authentication has failed.
// see https://bitbucket.org/sdorra/scm-manager/issue/545/git-clone-with-username-in-url-does-not
if (Boolean.TRUE.equals(request.getAttribute(ATTRIBUTE_FAILED_AUTH)))
@@ -221,7 +222,8 @@ public class BasicAuthenticationFilter extends AutoLoginFilter
}
else
{
HttpUtil.sendUnauthorized(request, response, configuration.getRealmDescription());
HttpUtil.sendUnauthorized(request, response,
configuration.getRealmDescription());
}
}
@@ -268,8 +270,10 @@ public class BasicAuthenticationFilter extends AutoLoginFilter
}
catch (AuthenticationException ex)
{
// add a marker to the request that the authentication has failed
request.setAttribute(ATTRIBUTE_FAILED_AUTH, Boolean.TRUE);
if (logger.isTraceEnabled())
{
logger.trace("authentication failed for user ".concat(username),