Search in sources :

Example 6 with UserService

use of org.graylog2.shared.users.UserService in project graylog2-server by Graylog2.

the class LdapUserAuthenticatorTest method testDoGetAuthenticationInfoDeniesEmptyPassword.

@Test
public void testDoGetAuthenticationInfoDeniesEmptyPassword() throws Exception {
    final LdapUserAuthenticator authenticator = new LdapUserAuthenticator(ldapConnector, ldapSettingsService, userService, mock(RoleService.class), DateTimeZone.UTC);
    when(ldapSettingsService.load()).thenReturn(ldapSettings);
    assertThat(authenticator.doGetAuthenticationInfo(new UsernamePasswordToken("john", (char[]) null))).isNull();
    assertThat(authenticator.doGetAuthenticationInfo(new UsernamePasswordToken("john", new char[0]))).isNull();
}
Also used : RoleService(org.graylog2.users.RoleService) UsernamePasswordToken(org.apache.shiro.authc.UsernamePasswordToken) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 User (org.graylog2.plugin.database.users.User)3 UsingDataSet (com.lordofthejars.nosqlunit.annotation.UsingDataSet)2 Configuration (org.graylog2.Configuration)2 Permissions (org.graylog2.shared.security.Permissions)2 LdapEntry (org.graylog2.shared.security.ldap.LdapEntry)2 LdapSettings (org.graylog2.shared.security.ldap.LdapSettings)2 UserService (org.graylog2.shared.users.UserService)2 UserImpl (org.graylog2.users.UserImpl)2 Before (org.junit.Before)2 LdapConnectionConfig (org.apache.directory.ldap.client.api.LdapConnectionConfig)1 UsernamePasswordToken (org.apache.shiro.authc.UsernamePasswordToken)1 InMemoryRolePermissionResolver (org.graylog2.security.InMemoryRolePermissionResolver)1 LdapConnector (org.graylog2.security.ldap.LdapConnector)1 LdapSettingsImpl (org.graylog2.security.ldap.LdapSettingsImpl)1 LdapSettingsService (org.graylog2.security.ldap.LdapSettingsService)1 Role (org.graylog2.shared.users.Role)1 RoleService (org.graylog2.users.RoleService)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1