mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
indent, javadoc and removed unused import
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user