Search in sources :

Example 1 with DefaultTenantsResolver

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);
}
Also used : DefaultTenantsResolver(org.craftercms.security.utils.tenant.DefaultTenantsResolver) DefaultAuthentication(org.craftercms.security.authentication.impl.DefaultAuthentication) Profile(org.craftercms.profile.api.Profile) Before(org.junit.Before)

Aggregations

Profile (org.craftercms.profile.api.Profile)1 DefaultAuthentication (org.craftercms.security.authentication.impl.DefaultAuthentication)1 DefaultTenantsResolver (org.craftercms.security.utils.tenant.DefaultTenantsResolver)1 Before (org.junit.Before)1