Search in sources :

Example 1 with InMemoryUserRepository

use of org.neo4j.server.security.auth.InMemoryUserRepository 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 InMemoryUserRepository

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

the class BasicAuthenticationTest method setup.

@Before
public void setup() throws Throwable {
    UserRepository userRepository = new InMemoryUserRepository();
    PasswordPolicy policy = mock(PasswordPolicy.class);
    BasicAuthManager manager = new BasicAuthManager(userRepository, policy, Clocks.systemClock(), userRepository);
    authentication = new BasicAuthentication(manager, manager);
    manager.newUser("bob", "secret", true);
    manager.newUser("mike", "secret2", false);
}
Also used : UserRepository(org.neo4j.server.security.auth.UserRepository) InMemoryUserRepository(org.neo4j.server.security.auth.InMemoryUserRepository) BasicAuthManager(org.neo4j.server.security.auth.BasicAuthManager) PasswordPolicy(org.neo4j.kernel.api.security.PasswordPolicy) InMemoryUserRepository(org.neo4j.server.security.auth.InMemoryUserRepository) Before(org.junit.Before)

Example 3 with InMemoryUserRepository

use of org.neo4j.server.security.auth.InMemoryUserRepository 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 4 with InMemoryUserRepository

use of org.neo4j.server.security.auth.InMemoryUserRepository 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)

Example 5 with InMemoryUserRepository

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

the class BasicSystemGraphRealmIT method setUp.

@BeforeEach
void setUp() {
    dbManager = new BasicSystemGraphRealmTestHelper.TestDatabaseManager(testDirectory);
    SecureHasher secureHasher = new SecureHasher();
    realmHelper = new SystemGraphRealmHelper(SystemGraphRealmHelper.makeSystemSupplier(dbManager), secureHasher);
    defaultConfig = Config.defaults();
    oldUsers = new InMemoryUserRepository();
    initialPassword = new InMemoryUserRepository();
}
Also used : SecureHasher(org.neo4j.cypher.internal.security.SecureHasher) InMemoryUserRepository(org.neo4j.server.security.auth.InMemoryUserRepository) SystemGraphRealmHelper(org.neo4j.server.security.systemgraph.SystemGraphRealmHelper) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

InMemoryUserRepository (org.neo4j.server.security.auth.InMemoryUserRepository)10 BasicPasswordPolicy (org.neo4j.server.security.auth.BasicPasswordPolicy)6 RateLimitedAuthenticationStrategy (org.neo4j.server.security.auth.RateLimitedAuthenticationStrategy)4 UserRepository (org.neo4j.server.security.auth.UserRepository)4 Before (org.junit.Before)3 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)3 SecurityLog (org.neo4j.server.security.enterprise.log.SecurityLog)3 Log (org.neo4j.logging.Log)2 AuthenticationStrategy (org.neo4j.server.security.auth.AuthenticationStrategy)2 BasicAuthManager (org.neo4j.server.security.auth.BasicAuthManager)2 FakeTicker (com.google.common.testing.FakeTicker)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 BeforeAll (org.junit.jupiter.api.BeforeAll)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Matchers.anyString (org.mockito.Matchers.anyString)1 DependencyResolver (org.neo4j.common.DependencyResolver)1 Config (org.neo4j.configuration.Config)1