Search in sources :

Example 1 with FileBasedAccessControlModule

use of com.facebook.presto.plugin.base.security.FileBasedAccessControlModule in project presto by prestodb.

the class RaptorSecurityModule method setup.

@Override
protected void setup(Binder binder) {
    bindSecurityModule("none", new AllowAllAccessControlModule());
    bindSecurityModule("read-only", new ReadOnlySecurityModule());
    bindSecurityModule("file", new FileBasedAccessControlModule());
}
Also used : AllowAllAccessControlModule(com.facebook.presto.plugin.base.security.AllowAllAccessControlModule) FileBasedAccessControlModule(com.facebook.presto.plugin.base.security.FileBasedAccessControlModule) ReadOnlySecurityModule(com.facebook.presto.plugin.base.security.ReadOnlySecurityModule)

Example 2 with FileBasedAccessControlModule

use of com.facebook.presto.plugin.base.security.FileBasedAccessControlModule in project presto by prestodb.

the class AtopConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> requiredConfig, ConnectorContext context) {
    requireNonNull(requiredConfig, "requiredConfig is null");
    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
        Bootstrap app = new Bootstrap(new AtopModule(atopFactoryClass, context.getTypeManager(), context.getNodeManager(), context.getNodeManager().getEnvironment(), catalogName), installModuleIf(AtopConnectorConfig.class, config -> config.getSecurity().equalsIgnoreCase(SECURITY_NONE), new AllowAllAccessControlModule()), installModuleIf(AtopConnectorConfig.class, config -> config.getSecurity().equalsIgnoreCase(SECURITY_FILE), binder -> {
            binder.install(new FileBasedAccessControlModule());
            binder.install(new JsonModule());
        }));
        Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(requiredConfig).initialize();
        return injector.getInstance(AtopConnector.class);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : Connector(com.facebook.presto.spi.connector.Connector) SECURITY_FILE(com.facebook.presto.atop.AtopConnectorConfig.SECURITY_FILE) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) ConnectorHandleResolver(com.facebook.presto.spi.ConnectorHandleResolver) ConditionalModule.installModuleIf(com.facebook.airlift.configuration.ConditionalModule.installModuleIf) SECURITY_NONE(com.facebook.presto.atop.AtopConnectorConfig.SECURITY_NONE) Throwables.throwIfUnchecked(com.google.common.base.Throwables.throwIfUnchecked) AllowAllAccessControlModule(com.facebook.presto.plugin.base.security.AllowAllAccessControlModule) ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) Injector(com.google.inject.Injector) FileBasedAccessControlModule(com.facebook.presto.plugin.base.security.FileBasedAccessControlModule) Map(java.util.Map) Objects.requireNonNull(java.util.Objects.requireNonNull) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader) ConnectorContext(com.facebook.presto.spi.connector.ConnectorContext) JsonModule(com.facebook.airlift.json.JsonModule) Injector(com.google.inject.Injector) AllowAllAccessControlModule(com.facebook.presto.plugin.base.security.AllowAllAccessControlModule) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) FileBasedAccessControlModule(com.facebook.presto.plugin.base.security.FileBasedAccessControlModule) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader) JsonModule(com.facebook.airlift.json.JsonModule)

Example 3 with FileBasedAccessControlModule

use of com.facebook.presto.plugin.base.security.FileBasedAccessControlModule in project presto by prestodb.

the class HiveSecurityModule method setup.

@Override
protected void setup(Binder binder) {
    bindSecurityModule("legacy", new LegacySecurityModule());
    bindSecurityModule("file", new FileBasedAccessControlModule());
    bindSecurityModule("read-only", new ReadOnlySecurityModule());
    bindSecurityModule("sql-standard", new SqlStandardSecurityModule());
}
Also used : FileBasedAccessControlModule(com.facebook.presto.plugin.base.security.FileBasedAccessControlModule) ReadOnlySecurityModule(com.facebook.presto.plugin.base.security.ReadOnlySecurityModule)

Aggregations

FileBasedAccessControlModule (com.facebook.presto.plugin.base.security.FileBasedAccessControlModule)3 AllowAllAccessControlModule (com.facebook.presto.plugin.base.security.AllowAllAccessControlModule)2 ReadOnlySecurityModule (com.facebook.presto.plugin.base.security.ReadOnlySecurityModule)2 Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)1 ConditionalModule.installModuleIf (com.facebook.airlift.configuration.ConditionalModule.installModuleIf)1 JsonModule (com.facebook.airlift.json.JsonModule)1 SECURITY_FILE (com.facebook.presto.atop.AtopConnectorConfig.SECURITY_FILE)1 SECURITY_NONE (com.facebook.presto.atop.AtopConnectorConfig.SECURITY_NONE)1 ConnectorHandleResolver (com.facebook.presto.spi.ConnectorHandleResolver)1 ThreadContextClassLoader (com.facebook.presto.spi.classloader.ThreadContextClassLoader)1 Connector (com.facebook.presto.spi.connector.Connector)1 ConnectorContext (com.facebook.presto.spi.connector.ConnectorContext)1 ConnectorFactory (com.facebook.presto.spi.connector.ConnectorFactory)1 Throwables.throwIfUnchecked (com.google.common.base.Throwables.throwIfUnchecked)1 Injector (com.google.inject.Injector)1 Map (java.util.Map)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1