use of org.neo4j.server.security.systemgraph.SystemGraphRealmHelper 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();
}
use of org.neo4j.server.security.systemgraph.SystemGraphRealmHelper in project neo4j by neo4j.
the class SecurityContextDescriptionTest method setup.
@BeforeEach
void setup() throws Throwable {
SystemGraphRealmHelper realmHelper = spy(new SystemGraphRealmHelper(null, new SecureHasher()));
BasicSystemGraphRealm realm = new BasicSystemGraphRealm(realmHelper, new RateLimitedAuthenticationStrategy(Clocks.systemClock(), Config.defaults()));
User user = new User.Builder("johan", credentialFor("bar")).withId("id").build();
doReturn(user).when(realmHelper).getUser("johan");
context = realm.login(authToken("johan", "bar"), EMBEDDED_CONNECTION).authorize(LoginContext.IdLookup.EMPTY, DEFAULT_DATABASE_NAME, CommunitySecurityLog.NULL_LOG);
}
use of org.neo4j.server.security.systemgraph.SystemGraphRealmHelper in project neo4j by neo4j.
the class CommunitySecurityModule method setup.
@Override
public void setup() {
Supplier<GraphDatabaseService> systemSupplier = () -> {
DatabaseManager<?> databaseManager = globalDependencies.resolveDependency(DatabaseManager.class);
return databaseManager.getDatabaseContext(NAMED_SYSTEM_DATABASE_ID).orElseThrow(() -> new RuntimeException("No database called `" + SYSTEM_DATABASE_NAME + "` was found.")).databaseFacade();
};
authManager = new BasicSystemGraphRealm(new SystemGraphRealmHelper(systemSupplier, new SecureHasher()), createAuthenticationStrategy(config));
registerProcedure(globalDependencies.resolveDependency(GlobalProcedures.class), logProvider.getLog(getClass()), AuthProcedures.class, null);
}
use of org.neo4j.server.security.systemgraph.SystemGraphRealmHelper in project neo4j by neo4j.
the class BasicSystemGraphRealmTest method setUp.
@BeforeEach
void setUp() {
authStrategy = mock(AuthenticationStrategy.class);
realmHelper = spy(new SystemGraphRealmHelper(null, new SecureHasher()));
realm = new BasicSystemGraphRealm(realmHelper, authStrategy);
}
use of org.neo4j.server.security.systemgraph.SystemGraphRealmHelper 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