Search in sources :

Example 1 with SecurityModule

use of org.neo4j.kernel.api.security.SecurityModule in project neo4j by neo4j.

the class EditionModule method setupSecurityModule.

protected static void setupSecurityModule(PlatformModule platformModule, Log log, Procedures procedures, String key) {
    for (SecurityModule candidate : Service.load(SecurityModule.class)) {
        if (candidate.matches(key)) {
            try {
                candidate.setup(new SecurityModule.Dependencies() {

                    @Override
                    public LogService logService() {
                        return platformModule.logging;
                    }

                    @Override
                    public Config config() {
                        return platformModule.config;
                    }

                    @Override
                    public Procedures procedures() {
                        return procedures;
                    }

                    @Override
                    public JobScheduler scheduler() {
                        return platformModule.jobScheduler;
                    }

                    @Override
                    public FileSystemAbstraction fileSystem() {
                        return platformModule.fileSystem;
                    }

                    @Override
                    public LifeSupport lifeSupport() {
                        return platformModule.life;
                    }

                    @Override
                    public DependencySatisfier dependencySatisfier() {
                        return platformModule.dependencies;
                    }
                });
                return;
            } catch (Exception e) {
                String errorMessage = "Failed to load security module.";
                log.error(errorMessage);
                throw new RuntimeException(errorMessage, e);
            }
        }
    }
    String errorMessage = "Failed to load security module with key '" + key + "'.";
    log.error(errorMessage);
    throw new IllegalArgumentException(errorMessage);
}
Also used : JobScheduler(org.neo4j.kernel.impl.util.JobScheduler) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) Config(org.neo4j.kernel.configuration.Config) Procedures(org.neo4j.kernel.impl.proc.Procedures) KernelException(org.neo4j.kernel.api.exceptions.KernelException) SecurityModule(org.neo4j.kernel.api.security.SecurityModule) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) DependencySatisfier(org.neo4j.kernel.impl.util.DependencySatisfier) LogService(org.neo4j.kernel.impl.logging.LogService)

Example 2 with SecurityModule

use of org.neo4j.kernel.api.security.SecurityModule in project neo4j by neo4j.

the class CommunityEditionModule method makeSecurityModule.

private SecurityProvider makeSecurityModule(GlobalModule globalModule) {
    globalModule.getGlobalDependencies().satisfyDependency(CommunitySecurityLog.NULL_LOG);
    setupSecurityGraphInitializer(globalModule);
    if (globalModule.getGlobalConfig().get(GraphDatabaseSettings.auth_enabled)) {
        SecurityModule securityModule = new CommunitySecurityModule(globalModule.getLogService(), globalModule.getGlobalConfig(), globalModule.getGlobalDependencies());
        securityModule.setup();
        return securityModule;
    }
    return NoAuthSecurityProvider.INSTANCE;
}
Also used : CommunitySecurityModule(org.neo4j.server.security.auth.CommunitySecurityModule) SecurityModule(org.neo4j.kernel.api.security.SecurityModule) CommunitySecurityModule(org.neo4j.server.security.auth.CommunitySecurityModule)

Aggregations

SecurityModule (org.neo4j.kernel.api.security.SecurityModule)2 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)1 KernelException (org.neo4j.kernel.api.exceptions.KernelException)1 Config (org.neo4j.kernel.configuration.Config)1 LogService (org.neo4j.kernel.impl.logging.LogService)1 Procedures (org.neo4j.kernel.impl.proc.Procedures)1 DependencySatisfier (org.neo4j.kernel.impl.util.DependencySatisfier)1 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)1 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)1 CommunitySecurityModule (org.neo4j.server.security.auth.CommunitySecurityModule)1