Search in sources :

Example 1 with BasicPasswordPolicy

use of org.neo4j.server.security.auth.BasicPasswordPolicy in project neo4j by neo4j.

the class UserManagementProceduresLoggingTest method getUserManager.

private EnterpriseUserManager getUserManager() throws Throwable {
    InternalFlatFileRealm realm = new InternalFlatFileRealm(new InMemoryUserRepository(), new InMemoryRoleRepository(), new BasicPasswordPolicy(), mock(AuthenticationStrategy.class), mock(JobScheduler.class), new InMemoryUserRepository(), new InMemoryUserRepository());
    // creates default user and roles
    realm.start();
    return realm;
}
Also used : JobScheduler(org.neo4j.kernel.impl.util.JobScheduler) AuthenticationStrategy(org.neo4j.server.security.auth.AuthenticationStrategy) InMemoryUserRepository(org.neo4j.server.security.auth.InMemoryUserRepository) BasicPasswordPolicy(org.neo4j.server.security.auth.BasicPasswordPolicy)

Example 2 with BasicPasswordPolicy

use of org.neo4j.server.security.auth.BasicPasswordPolicy 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();
}
Also used : JobScheduler(org.neo4j.kernel.impl.util.JobScheduler) LogProvider(org.neo4j.logging.LogProvider) NullLogProvider(org.neo4j.logging.NullLogProvider) RateLimitedAuthenticationStrategy(org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy) Config(org.neo4j.kernel.configuration.Config) InternalFlatFileRealm(org.neo4j.server.security.enterprise.auth.InternalFlatFileRealm) BasicPasswordPolicy(org.neo4j.server.security.auth.BasicPasswordPolicy) Before(org.junit.Before)

Example 3 with BasicPasswordPolicy

use of org.neo4j.server.security.auth.BasicPasswordPolicy 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();
}
Also used : FileUserRepository(org.neo4j.server.security.auth.FileUserRepository) RateLimitedAuthenticationStrategy(org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy) UserRepository(org.neo4j.server.security.auth.UserRepository) FileUserRepository(org.neo4j.server.security.auth.FileUserRepository) EphemeralFileSystemAbstraction(org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction) AuthenticationStrategy(org.neo4j.server.security.auth.AuthenticationStrategy) RateLimitedAuthenticationStrategy(org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy) PasswordPolicy(org.neo4j.kernel.api.security.PasswordPolicy) BasicPasswordPolicy(org.neo4j.server.security.auth.BasicPasswordPolicy) File(java.io.File) BasicPasswordPolicy(org.neo4j.server.security.auth.BasicPasswordPolicy) Before(org.junit.Before)

Example 4 with BasicPasswordPolicy

use of org.neo4j.server.security.auth.BasicPasswordPolicy 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));
}
Also used : RateLimitedAuthenticationStrategy(org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy) Log(org.neo4j.logging.Log) SecurityLog(org.neo4j.server.security.enterprise.log.SecurityLog) SecurityLog(org.neo4j.server.security.enterprise.log.SecurityLog) InMemoryUserRepository(org.neo4j.server.security.auth.InMemoryUserRepository) BasicPasswordPolicy(org.neo4j.server.security.auth.BasicPasswordPolicy) Before(org.junit.Before)

Example 5 with BasicPasswordPolicy

use of org.neo4j.server.security.auth.BasicPasswordPolicy 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);
}
Also used : JobScheduler(org.neo4j.kernel.impl.util.JobScheduler) RateLimitedAuthenticationStrategy(org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy) SecurityLog(org.neo4j.server.security.enterprise.log.SecurityLog) InMemoryUserRepository(org.neo4j.server.security.auth.InMemoryUserRepository) FakeTicker(com.google.common.testing.FakeTicker) BasicPasswordPolicy(org.neo4j.server.security.auth.BasicPasswordPolicy) Realm(org.apache.shiro.realm.Realm) Before(org.junit.Before)

Aggregations

BasicPasswordPolicy (org.neo4j.server.security.auth.BasicPasswordPolicy)9 InMemoryUserRepository (org.neo4j.server.security.auth.InMemoryUserRepository)7 RateLimitedAuthenticationStrategy (org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy)7 Before (org.junit.Before)4 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)4 UserRepository (org.neo4j.server.security.auth.UserRepository)4 AuthenticationStrategy (org.neo4j.server.security.auth.AuthenticationStrategy)3 SecurityLog (org.neo4j.server.security.enterprise.log.SecurityLog)3 PasswordPolicy (org.neo4j.kernel.api.security.PasswordPolicy)2 Log (org.neo4j.logging.Log)2 FakeTicker (com.google.common.testing.FakeTicker)1 File (java.io.File)1 StringWriter (java.io.StringWriter)1 MemoryConstrainedCacheManager (org.apache.shiro.cache.MemoryConstrainedCacheManager)1 Realm (org.apache.shiro.realm.Realm)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 EphemeralFileSystemAbstraction (org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction)1 InvalidArgumentsException (org.neo4j.kernel.api.exceptions.InvalidArgumentsException)1 Config (org.neo4j.kernel.configuration.Config)1