use of org.craftercms.security.utils.tenant.DefaultTenantsResolver in project profile by craftercms.
the class LoginProcessorTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
DefaultTenantsResolver resolver = new DefaultTenantsResolver();
resolver.setDefaultTenantNames(TENANTS);
processor = new LoginProcessor();
processor.setTenantsResolver(resolver);
processor.setAuthenticationManager(authenticationManager);
processor.setLoginSuccessHandler(loginSuccessHandler);
processor.setLoginFailureHandler(loginFailureHandler);
processor.setRememberMeManager(rememberMeManager);
Profile profile = new Profile();
profile.setUsername(USERNAME);
when(authenticationManager.authenticateUser(TENANTS, USERNAME, VALID_PASSWORD)).thenReturn(new DefaultAuthentication(TICKET, profile));
doThrow(BadCredentialsException.class).when(authenticationManager).authenticateUser(TENANTS, USERNAME, INVALID_PASSWORD);
}
Aggregations