use of org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy in project neo4j by neo4j.
the class FlatFileStressBase method setup.
@Before
public void setup() throws Throwable {
Config config = Config.defaults();
LogProvider logProvider = NullLogProvider.getInstance();
JobScheduler jobScheduler = new NoopJobScheduler();
userRepository = CommunitySecurityModule.getUserRepository(config, logProvider, getFileSystem());
roleRepository = EnterpriseSecurityModule.getRoleRepository(config, logProvider, getFileSystem());
flatFileRealm = new InternalFlatFileRealm(userRepository, roleRepository, new BasicPasswordPolicy(), new RateLimitedAuthenticationStrategy(Clock.systemUTC(), 3), jobScheduler, CommunitySecurityModule.getInitialUserRepository(config, logProvider, getFileSystem()), EnterpriseSecurityModule.getDefaultAdminRepository(config, logProvider, getFileSystem()));
flatFileRealm.init();
flatFileRealm.start();
}
use of org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy in project neo4j by neo4j.
the class InternalFlatFileRealmIT method setup.
@Before
public void setup() throws Throwable {
fs = new EvilFileSystem(new EphemeralFileSystemAbstraction());
userStoreFile = new File("dbms", "auth");
roleStoreFile = new File("dbms", "roles");
final UserRepository userRepository = new FileUserRepository(fs, userStoreFile, logProvider);
final RoleRepository roleRepository = new FileRoleRepository(fs, roleStoreFile, logProvider);
final UserRepository initialUserRepository = CommunitySecurityModule.getInitialUserRepository(Config.defaults(), logProvider, fs);
final UserRepository defaultAdminRepository = EnterpriseSecurityModule.getDefaultAdminRepository(Config.defaults(), logProvider, fs);
final PasswordPolicy passwordPolicy = new BasicPasswordPolicy();
AuthenticationStrategy authenticationStrategy = new RateLimitedAuthenticationStrategy(Clocks.systemClock(), 3);
realm = new InternalFlatFileRealm(userRepository, roleRepository, passwordPolicy, authenticationStrategy, true, true, jobScheduler, initialUserRepository, defaultAdminRepository);
realm.init();
realm.start();
}
use of org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy in project neo4j by neo4j.
the class PersonalUserManagerTest method setup.
@Before
public void setup() {
evilUserManager = new EvilUserManager(new InternalFlatFileRealm(new InMemoryUserRepository(), new InMemoryRoleRepository(), new BasicPasswordPolicy(), new RateLimitedAuthenticationStrategy(Clock.systemUTC(), 3), new InternalFlatFileRealmIT.TestJobScheduler(), new InMemoryUserRepository(), new InMemoryUserRepository()));
log = spy(Log.class);
userManager = new PersonalUserManager(evilUserManager, SecurityContext.AUTH_DISABLED, new SecurityLog(log));
}
use of org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy in project neo4j by neo4j.
the class LdapCachingTest method setup.
@Before
public void setup() throws Throwable {
SecurityLog securityLog = mock(SecurityLog.class);
InternalFlatFileRealm internalFlatFileRealm = new InternalFlatFileRealm(new InMemoryUserRepository(), new InMemoryRoleRepository(), new BasicPasswordPolicy(), new RateLimitedAuthenticationStrategy(Clock.systemUTC(), 3), mock(JobScheduler.class), new InMemoryUserRepository(), new InMemoryUserRepository());
testRealm = new TestRealm(getLdapConfig(), securityLog, new SecureHasher());
List<Realm> realms = listOf(internalFlatFileRealm, testRealm);
fakeTicker = new FakeTicker();
authManager = new MultiRealmAuthManager(internalFlatFileRealm, realms, new ShiroCaffeineCache.Manager(fakeTicker::read, 100, 10), securityLog, false);
authManager.init();
authManager.start();
authManager.getUserManager().newUser("mike", "123", false);
authManager.getUserManager().newUser("mats", "456", false);
}
use of org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy in project neo4j by neo4j.
the class BasicSystemGraphRealmIT method startSystemGraphRealm.
private void startSystemGraphRealm() throws Exception {
Config config = Config.defaults(DatabaseManagementSystemSettings.auth_store_directory, testDirectory.directory("data/dbms"));
var systemGraphComponents = new SystemGraphComponents();
systemGraphComponents.register(new DefaultSystemGraphComponent(config));
systemGraphComponents.register(new UserSecurityGraphComponent(Mockito.mock(AbstractSecurityLog.class), oldUsers, initialPassword, config));
var systemGraphSupplier = SystemGraphRealmHelper.makeSystemSupplier(dbManager);
systemGraphInitializer = new DefaultSystemGraphInitializer(systemGraphSupplier, systemGraphComponents);
systemGraphInitializer.start();
RateLimitedAuthenticationStrategy authStrategy = new RateLimitedAuthenticationStrategy(Clock.systemUTC(), config);
realm = new BasicSystemGraphRealm(realmHelper, authStrategy);
}
Aggregations