use of org.neo4j.kernel.api.security.AuthManager in project neo4j by neo4j.
the class AuthorizationEnabledFilter method authenticate.
private SecurityContext authenticate(String username, String password) throws InvalidAuthTokenException {
AuthManager authManager = authManagerSupplier.get();
Map<String, Object> authToken = newBasicAuthToken(username, password);
return authManager.login(authToken);
}
use of org.neo4j.kernel.api.security.AuthManager in project neo4j by neo4j.
the class AuthorizationEnabledFilter method authenticate.
private LoginContext authenticate(String username, String password, ClientConnectionInfo connectionInfo) throws InvalidAuthTokenException {
AuthManager authManager = authManagerSupplier.get();
Map<String, Object> authToken = newBasicAuthToken(username, password != null ? UTF8.encode(password) : null);
return authManager.login(authToken, connectionInfo);
}
use of org.neo4j.kernel.api.security.AuthManager in project neo4j by neo4j.
the class UserSecurityGraphComponentTest method setup.
@BeforeAll
static void setup() throws IOException, InvalidArgumentsException {
Config cfg = Config.newBuilder().set(auth_enabled, TRUE).set(allow_single_automatic_upgrade, FALSE).build();
dbms = new TestDatabaseManagementServiceBuilder(directory.homePath()).impermanent().setConfig(cfg).noOpSystemGraphInitializer().build();
system = (GraphDatabaseFacade) dbms.database(SYSTEM_DATABASE_NAME);
DependencyResolver resolver = system.getDependencyResolver();
systemGraphComponents = resolver.resolveDependency(SystemGraphComponents.class);
authManager = resolver.resolveDependency(AuthManager.class);
// Insert a custom SecurityUserComponent instead of the default one,
// in order to have a handle on it and to migrate a 3.5 user
systemGraphComponents.deregister(SECURITY_USER_COMPONENT);
UserRepository oldUsers = new InMemoryUserRepository();
User oldUser = new User.Builder("alice", credentialFor("secret")).withRequiredPasswordChange(false).build();
oldUsers.create(oldUser);
UserRepository initialPassword = new InMemoryUserRepository();
userSecurityGraphComponent = new UserSecurityGraphComponent(CommunitySecurityLog.NULL_LOG, oldUsers, initialPassword, Config.defaults());
systemGraphComponents.register(userSecurityGraphComponent);
// remove DBMS runtime component as it is not a subject of this test
systemGraphComponents.deregister(DBMS_RUNTIME_COMPONENT);
}
Aggregations