mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
remove unnecessary provider
This commit is contained in:
@@ -36,7 +36,6 @@ package sonia.scm.web.security;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -86,22 +85,25 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager
|
||||
* @param encryptionHandler
|
||||
* @param cacheManager
|
||||
* @param authenticationListenerProvider
|
||||
* @param authenticationListeners
|
||||
*/
|
||||
@Inject
|
||||
public ChainAuthenticatonManager(
|
||||
Set<AuthenticationHandler> authenticationHandlerSet,
|
||||
EncryptionHandler encryptionHandler, CacheManager cacheManager,
|
||||
Provider<Set<AuthenticationListener>> authenticationListenerProvider)
|
||||
Set<AuthenticationListener> authenticationListeners)
|
||||
{
|
||||
AssertUtil.assertIsNotEmpty(authenticationHandlerSet);
|
||||
AssertUtil.assertIsNotNull(cacheManager);
|
||||
this.authenticationHandlerSet = authenticationHandlerSet;
|
||||
this.encryptionHandler = encryptionHandler;
|
||||
this.authenticationListenerProvider = authenticationListenerProvider;
|
||||
this.cache = cacheManager.getCache(String.class,
|
||||
AuthenticationCacheValue.class, CACHE_NAME);
|
||||
|
||||
// addListeners(authenticationListeners);
|
||||
if (Util.isNotEmpty(authenticationListeners))
|
||||
{
|
||||
addListeners(authenticationListeners);
|
||||
}
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -189,14 +191,6 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager
|
||||
|
||||
authenticator.init(context);
|
||||
}
|
||||
|
||||
Set<AuthenticationListener> listeners =
|
||||
authenticationListenerProvider.get();
|
||||
|
||||
if (Util.isNotEmpty(listeners))
|
||||
{
|
||||
addListeners(listeners);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -346,9 +340,6 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager
|
||||
/** Field description */
|
||||
private Set<AuthenticationHandler> authenticationHandlerSet;
|
||||
|
||||
/** Field description */
|
||||
private Provider<Set<AuthenticationListener>> authenticationListenerProvider;
|
||||
|
||||
/** Field description */
|
||||
private Cache<String, AuthenticationCacheValue> cache;
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ import static org.mockito.Mockito.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -134,15 +135,9 @@ public class ChainAuthenticationManagerTest extends AbstractTestBase
|
||||
trillian.setPassword("trillian123");
|
||||
handlerSet.add(new SingleUserAuthenticaionHandler("trilliansType",
|
||||
trillian));
|
||||
|
||||
Provider<Set<AuthenticationListener>> listenerProvider =
|
||||
mock(Provider.class);
|
||||
|
||||
when(listenerProvider.get()).thenReturn(
|
||||
new HashSet<AuthenticationListener>());
|
||||
manager = new ChainAuthenticatonManager(handlerSet,
|
||||
new MessageDigestEncryptionHandler(), cacheManager,
|
||||
listenerProvider);
|
||||
Collections.EMPTY_SET);
|
||||
manager.init(contextProvider);
|
||||
request = MockUtil.getHttpServletRequest();
|
||||
response = MockUtil.getHttpServletResponse();
|
||||
|
||||
Reference in New Issue
Block a user