use of org.neo4j.cypher.internal.security.SecureHasher in project neo4j by neo4j.
the class BasicAuthenticationTest method createAuthentication.
private static Authentication createAuthentication(int maxFailedAttempts) throws Exception {
Config config = Config.defaults(GraphDatabaseSettings.auth_max_failed_attempts, maxFailedAttempts);
SystemGraphRealmHelper realmHelper = spy(new SystemGraphRealmHelper(null, new SecureHasher()));
BasicSystemGraphRealm realm = new BasicSystemGraphRealm(realmHelper, new RateLimitedAuthenticationStrategy(Clocks.systemClock(), config));
Authentication authentication = new BasicAuthentication(realm);
doReturn(new User.Builder("bob", credentialFor("secret")).withRequiredPasswordChange(true).build()).when(realmHelper).getUser("bob");
doReturn(new User.Builder("mike", credentialFor("secret2")).build()).when(realmHelper).getUser("mike");
return authentication;
}
Aggregations