mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-23 16:59:48 +01:00
merge with branch issue-870
This commit is contained in:
@@ -35,26 +35,19 @@ package sonia.scm.web;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import org.eclipse.jgit.http.server.GitSmartHttpTools;
|
|
||||||
|
|
||||||
import sonia.scm.ClientMessages;
|
|
||||||
import sonia.scm.config.ScmConfiguration;
|
import sonia.scm.config.ScmConfiguration;
|
||||||
import sonia.scm.repository.GitUtil;
|
|
||||||
import sonia.scm.web.filter.AutoLoginModule;
|
import sonia.scm.web.filter.AutoLoginModule;
|
||||||
import sonia.scm.web.filter.BasicAuthenticationFilter;
|
import sonia.scm.web.filter.BasicAuthenticationFilter;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Handles git specific basic authentication.
|
||||||
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -62,12 +55,12 @@ public class GitBasicAuthenticationFilter extends BasicAuthenticationFilter
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs ...
|
* Constructs a new instance.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param configuration
|
* @param configuration scm-manager main configuration
|
||||||
* @param autoLoginModules
|
* @param autoLoginModules auto login modules
|
||||||
* @param userAgentParser
|
* @param userAgentParser user agent parser
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public GitBasicAuthenticationFilter(ScmConfiguration configuration,
|
public GitBasicAuthenticationFilter(ScmConfiguration configuration,
|
||||||
@@ -75,32 +68,4 @@ public class GitBasicAuthenticationFilter extends BasicAuthenticationFilter
|
|||||||
{
|
{
|
||||||
super(configuration, autoLoginModules, userAgentParser);
|
super(configuration, autoLoginModules, userAgentParser);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param response
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void sendFailedAuthenticationError(HttpServletRequest request,
|
|
||||||
HttpServletResponse response)
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
if (GitUtil.isGitClient(request))
|
|
||||||
{
|
|
||||||
GitSmartHttpTools.sendError(request, response,
|
|
||||||
HttpServletResponse.SC_FORBIDDEN,
|
|
||||||
ClientMessages.get(request).failedAuthentication());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
super.sendFailedAuthenticationError(request, response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user