mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
use default type of user manager for default authentication
This commit is contained in:
@@ -57,7 +57,7 @@ import sonia.scm.security.EncryptionHandler;
|
||||
import sonia.scm.user.UserListener;
|
||||
import sonia.scm.web.security.AuthenticationHandler;
|
||||
import sonia.scm.web.security.AuthenticationListener;
|
||||
import sonia.scm.web.security.XmlAuthenticationHandler;
|
||||
import sonia.scm.web.security.DefaultAuthenticationHandler;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -134,7 +134,7 @@ public class BindingExtensionProcessor implements ExtensionProcessor
|
||||
Multibinder<RepositoryRequestListener> repositoryRequestListenerBinder =
|
||||
Multibinder.newSetBinder(binder, RepositoryRequestListener.class);
|
||||
|
||||
authenticators.addBinding().to(XmlAuthenticationHandler.class);
|
||||
authenticators.addBinding().to(DefaultAuthenticationHandler.class);
|
||||
|
||||
for (Class extensionClass : extensions)
|
||||
{
|
||||
|
||||
@@ -58,18 +58,15 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Singleton
|
||||
public class XmlAuthenticationHandler implements AuthenticationHandler
|
||||
public class DefaultAuthenticationHandler implements AuthenticationHandler
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String NAME_DIRECTORY = "users";
|
||||
|
||||
/** Field description */
|
||||
public static final String TYPE = "xml";
|
||||
|
||||
/** the logger for XmlAuthenticationHandler */
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(XmlAuthenticationHandler.class);
|
||||
LoggerFactory.getLogger(DefaultAuthenticationHandler.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
@@ -81,7 +78,7 @@ public class XmlAuthenticationHandler implements AuthenticationHandler
|
||||
* @param encryptionHandler
|
||||
*/
|
||||
@Inject
|
||||
public XmlAuthenticationHandler(UserManager userManager,
|
||||
public DefaultAuthenticationHandler(UserManager userManager,
|
||||
EncryptionHandler encryptionHandler)
|
||||
{
|
||||
this.userManager = userManager;
|
||||
@@ -110,7 +107,7 @@ public class XmlAuthenticationHandler implements AuthenticationHandler
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
if (TYPE.equals(user.getType()))
|
||||
if (userManager.getDefaultType().equals(user.getType()))
|
||||
{
|
||||
result = authenticate(user, username, password);
|
||||
}
|
||||
@@ -118,7 +115,8 @@ public class XmlAuthenticationHandler implements AuthenticationHandler
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("{} is not an xml user", username);
|
||||
logger.debug("{} is not an {} user", username,
|
||||
userManager.getDefaultType());
|
||||
}
|
||||
|
||||
result = AuthenticationResult.NOT_FOUND;
|
||||
@@ -174,7 +172,7 @@ public class XmlAuthenticationHandler implements AuthenticationHandler
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return TYPE;
|
||||
return userManager.getDefaultType();
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -67,7 +67,7 @@ import sonia.scm.user.xml.XmlUserDAO;
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class XmlAuthenticationHandlerTest extends AbstractTestBase
|
||||
public class DefaultAuthenticationHandlerTest extends AbstractTestBase
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -148,7 +148,7 @@ public class XmlAuthenticationHandlerTest extends AbstractTestBase
|
||||
|
||||
userManager.init(contextProvider);
|
||||
userManager.create(slarti);
|
||||
handler = new XmlAuthenticationHandler(userManager, enc);
|
||||
handler = new DefaultAuthenticationHandler(userManager, enc);
|
||||
handler.init(contextProvider);
|
||||
request = MockUtil.getHttpServletRequest();
|
||||
reponse = MockUtil.getHttpServletResponse();
|
||||
@@ -169,7 +169,7 @@ public class XmlAuthenticationHandlerTest extends AbstractTestBase
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private XmlAuthenticationHandler handler;
|
||||
private DefaultAuthenticationHandler handler;
|
||||
|
||||
/** Field description */
|
||||
private HttpServletResponse reponse;
|
||||
Reference in New Issue
Block a user