Search in sources :

Example 1 with SocketChannelSocketFactory

use of io.prestosql.client.SocketChannelSocketFactory in project hetu-core by openlookeng.

the class QueryEditorUIModule method provideOkHttpClient.

@Singleton
@Provides
public OkHttpClient provideOkHttpClient(HttpServerConfig serverConfig, InternalCommunicationConfig internalCommunicationConfig, InternalAuthenticationManager internalAuthenticationManager) {
    OkHttpClient.Builder builder = new OkHttpClient.Builder();
    builder.socketFactory(new SocketChannelSocketFactory());
    setupTimeouts(builder, 30, SECONDS);
    setupCookieJar(builder);
    if (serverConfig.isHttpsEnabled() && internalCommunicationConfig.isHttpsRequired()) {
        setupSsl(builder, Optional.of(serverConfig.getKeystorePath()), Optional.of(serverConfig.getKeystorePassword()), Optional.of(serverConfig.getKeystorePath()), Optional.of(serverConfig.getKeystorePassword()));
        // Setup the authorization for UI queries
        Interceptor authInterceptor = chain -> chain.proceed(internalAuthenticationManager.getJwtGenerator().map(Supplier::get).map(jwt -> chain.request().newBuilder().header(InternalAuthenticationManager.PRESTO_INTERNAL_BEARER, jwt).build()).orElse(chain.request()));
        builder.addInterceptor(authInterceptor);
        internalAuthenticationManager.getJwtGenerator().map(Supplier::get).orElse(null);
    }
    return builder.build();
}
Also used : ExecutionError(io.prestosql.queryeditorui.protocol.ExecutionStatus.ExecutionError) InternalCommunicationConfig(io.prestosql.server.InternalCommunicationConfig) ExecutionSuccess(io.prestosql.queryeditorui.protocol.ExecutionStatus.ExecutionSuccess) LoginResource(io.prestosql.queryeditorui.resources.LoginResource) HttpServerConfig(io.airlift.http.server.HttpServerConfig) Duration(io.airlift.units.Duration) UserResource(io.prestosql.queryeditorui.resources.UserResource) QueryInfoClient(io.prestosql.queryeditorui.execution.QueryInfoClient) QueryRunnerFactory(io.prestosql.queryeditorui.execution.QueryRunner.QueryRunnerFactory) URI(java.net.URI) SchemaService(io.prestosql.queryeditorui.metadata.SchemaService) WebUIAuthenticator(io.prestosql.server.security.WebUIAuthenticator) ExpiringFileStore(io.prestosql.queryeditorui.store.files.ExpiringFileStore) Interceptor(okhttp3.Interceptor) JsonCodecBinder.jsonCodecBinder(io.airlift.json.JsonCodecBinder.jsonCodecBinder) LocalJobHistoryStore(io.prestosql.queryeditorui.store.history.LocalJobHistoryStore) OkHttpUtil.setupTimeouts(io.prestosql.client.OkHttpUtil.setupTimeouts) FilesResource(io.prestosql.queryeditorui.resources.FilesResource) UiAuthenticator(io.prestosql.queryeditorui.security.UiAuthenticator) HttpClientBinder.httpClientBinder(io.airlift.http.client.HttpClientBinder.httpClientBinder) DataSize(io.airlift.units.DataSize) InMemoryActiveJobsStore(io.prestosql.queryeditorui.store.jobs.jobs.InMemoryActiveJobsStore) QueryStore(io.prestosql.queryeditorui.store.queries.QueryStore) JaxrsBinder.jaxrsBinder(io.airlift.jaxrs.JaxrsBinder.jaxrsBinder) Optional(java.util.Optional) MetadataResource(io.prestosql.queryeditorui.resources.MetadataResource) ConfigBinder.configBinder(io.airlift.configuration.ConfigBinder.configBinder) ClientSessionFactory(io.prestosql.queryeditorui.execution.ClientSessionFactory) Singleton(com.google.inject.Singleton) ConfigDefaults(io.airlift.configuration.ConfigDefaults) JobHistoryStore(io.prestosql.queryeditorui.store.history.JobHistoryStore) InMemoryQueryStore(io.prestosql.queryeditorui.store.queries.InMemoryQueryStore) OkHttpUtil.setupSsl(io.prestosql.client.OkHttpUtil.setupSsl) ResultsPreviewResource(io.prestosql.queryeditorui.resources.ResultsPreviewResource) ExecutionClient(io.prestosql.queryeditorui.execution.ExecutionClient) UIExecuteResource(io.prestosql.queryeditorui.resources.UIExecuteResource) OkHttpUtil.setupCookieJar(io.prestosql.client.OkHttpUtil.setupCookieJar) Supplier(java.util.function.Supplier) SocketChannelSocketFactory(io.prestosql.client.SocketChannelSocketFactory) PersistentJobOutputFactory(io.prestosql.queryeditorui.output.PersistentJobOutputFactory) AbstractConfigurationAwareModule(io.airlift.configuration.AbstractConfigurationAwareModule) Binder(com.google.inject.Binder) InternalAuthenticationManager(io.prestosql.server.InternalAuthenticationManager) Named(javax.inject.Named) ConnectorResource(io.prestosql.queryeditorui.resources.ConnectorResource) PersistorFactory(io.prestosql.queryeditorui.output.persistors.PersistorFactory) OutputBuilderFactory(io.prestosql.queryeditorui.output.builders.OutputBuilderFactory) QueryResource(io.prestosql.queryeditorui.resources.QueryResource) IOException(java.io.IOException) Scopes(com.google.inject.Scopes) CSVPersistorFactory(io.prestosql.queryeditorui.output.persistors.CSVPersistorFactory) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) Provider(com.google.inject.Provider) ActiveJobsStore(io.prestosql.queryeditorui.store.jobs.jobs.ActiveJobsStore) Provides(com.google.inject.Provides) OkHttpClient(okhttp3.OkHttpClient) ColumnService(io.prestosql.queryeditorui.metadata.ColumnService) HttpClientConfig(io.airlift.http.client.HttpClientConfig) PreviewTableService(io.prestosql.queryeditorui.metadata.PreviewTableService) SECONDS(java.util.concurrent.TimeUnit.SECONDS) SocketChannelSocketFactory(io.prestosql.client.SocketChannelSocketFactory) OkHttpClient(okhttp3.OkHttpClient) Interceptor(okhttp3.Interceptor) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Binder (com.google.inject.Binder)1 Provider (com.google.inject.Provider)1 Provides (com.google.inject.Provides)1 Scopes (com.google.inject.Scopes)1 Singleton (com.google.inject.Singleton)1 AbstractConfigurationAwareModule (io.airlift.configuration.AbstractConfigurationAwareModule)1 ConfigBinder.configBinder (io.airlift.configuration.ConfigBinder.configBinder)1 ConfigDefaults (io.airlift.configuration.ConfigDefaults)1 HttpClientBinder.httpClientBinder (io.airlift.http.client.HttpClientBinder.httpClientBinder)1 HttpClientConfig (io.airlift.http.client.HttpClientConfig)1 HttpServerConfig (io.airlift.http.server.HttpServerConfig)1 JaxrsBinder.jaxrsBinder (io.airlift.jaxrs.JaxrsBinder.jaxrsBinder)1 JsonCodecBinder.jsonCodecBinder (io.airlift.json.JsonCodecBinder.jsonCodecBinder)1 DataSize (io.airlift.units.DataSize)1 Duration (io.airlift.units.Duration)1 OkHttpUtil.setupCookieJar (io.prestosql.client.OkHttpUtil.setupCookieJar)1 OkHttpUtil.setupSsl (io.prestosql.client.OkHttpUtil.setupSsl)1 OkHttpUtil.setupTimeouts (io.prestosql.client.OkHttpUtil.setupTimeouts)1 SocketChannelSocketFactory (io.prestosql.client.SocketChannelSocketFactory)1 ClientSessionFactory (io.prestosql.queryeditorui.execution.ClientSessionFactory)1