Search in sources :

Example 1 with PasswordAlgorithm

use of org.graylog2.plugin.security.PasswordAlgorithm in project graylog2-server by Graylog2.

the class MigrationHelpersTest method newUser.

private User newUser(Permissions permissions) {
    final BCryptPasswordAlgorithm passwordAlgorithm = new BCryptPasswordAlgorithm(10);
    final PasswordAlgorithmFactory passwordAlgorithmFactory = new PasswordAlgorithmFactory(Collections.emptyMap(), passwordAlgorithm);
    return new UserImpl(passwordAlgorithmFactory, permissions, ImmutableMap.of());
}
Also used : PasswordAlgorithmFactory(org.graylog2.security.PasswordAlgorithmFactory) BCryptPasswordAlgorithm(org.graylog2.security.hashing.BCryptPasswordAlgorithm) UserImpl(org.graylog2.users.UserImpl)

Example 2 with PasswordAlgorithm

use of org.graylog2.plugin.security.PasswordAlgorithm in project graylog2-server by Graylog2.

the class PasswordAlgorithmFactoryTest method testDefaultPasswordAlgorithm.

@Test
public void testDefaultPasswordAlgorithm() throws Exception {
    final PasswordAlgorithm defaultPasswordAlgorithm = mock(PasswordAlgorithm.class);
    final PasswordAlgorithmFactory passwordAlgorithmFactory = new PasswordAlgorithmFactory(Collections.<String, PasswordAlgorithm>emptyMap(), defaultPasswordAlgorithm);
    assertThat(passwordAlgorithmFactory.defaultPasswordAlgorithm()).isEqualTo(defaultPasswordAlgorithm);
}
Also used : PasswordAlgorithm(org.graylog2.plugin.security.PasswordAlgorithm) Test(org.junit.Test)

Aggregations

PasswordAlgorithm (org.graylog2.plugin.security.PasswordAlgorithm)1 PasswordAlgorithmFactory (org.graylog2.security.PasswordAlgorithmFactory)1 BCryptPasswordAlgorithm (org.graylog2.security.hashing.BCryptPasswordAlgorithm)1 UserImpl (org.graylog2.users.UserImpl)1 Test (org.junit.Test)1