Search in sources :

Example 1 with AuthenticationPluginHandler

use of io.confluent.ksql.api.auth.AuthenticationPluginHandler in project ksql by confluentinc.

the class AuthHandlers method setupAuthHandlers.

static void setupAuthHandlers(final Server server, final Router router, final boolean isInternalListener) {
    final Optional<AuthHandler> jaasAuthHandler = getJaasAuthHandler(server);
    final KsqlSecurityExtension securityExtension = server.getSecurityExtension();
    final Optional<AuthenticationPlugin> authenticationPlugin = server.getAuthenticationPlugin();
    final Optional<Handler<RoutingContext>> pluginHandler = authenticationPlugin.map(plugin -> new AuthenticationPluginHandler(server, plugin));
    final Optional<SystemAuthenticationHandler> systemAuthenticationHandler = getSystemAuthenticationHandler(server, isInternalListener);
    systemAuthenticationHandler.ifPresent(handler -> router.route().handler(handler));
    if (jaasAuthHandler.isPresent() || authenticationPlugin.isPresent()) {
        router.route().handler(AuthHandlers::pauseHandler);
        router.route().handler(rc -> wrappedAuthHandler(rc, jaasAuthHandler, pluginHandler));
        // For authorization use auth provider configured via security extension (if any)
        securityExtension.getAuthorizationProvider().ifPresent(ksqlAuthorizationProvider -> router.route().handler(new KsqlAuthorizationProviderHandler(server.getWorkerExecutor(), ksqlAuthorizationProvider)));
        router.route().handler(AuthHandlers::resumeHandler);
    }
}
Also used : AuthHandler(io.vertx.ext.web.handler.AuthHandler) BasicAuthHandler(io.vertx.ext.web.handler.BasicAuthHandler) SystemAuthenticationHandler(io.confluent.ksql.api.auth.SystemAuthenticationHandler) AuthenticationPluginHandler(io.confluent.ksql.api.auth.AuthenticationPluginHandler) AuthenticationPlugin(io.confluent.ksql.api.auth.AuthenticationPlugin) AuthHandler(io.vertx.ext.web.handler.AuthHandler) SystemAuthenticationHandler(io.confluent.ksql.api.auth.SystemAuthenticationHandler) AuthenticationPluginHandler(io.confluent.ksql.api.auth.AuthenticationPluginHandler) BasicAuthHandler(io.vertx.ext.web.handler.BasicAuthHandler) KsqlAuthorizationProviderHandler(io.confluent.ksql.api.auth.KsqlAuthorizationProviderHandler) Handler(io.vertx.core.Handler) KsqlAuthorizationProviderHandler(io.confluent.ksql.api.auth.KsqlAuthorizationProviderHandler) KsqlSecurityExtension(io.confluent.ksql.security.KsqlSecurityExtension)

Aggregations

AuthenticationPlugin (io.confluent.ksql.api.auth.AuthenticationPlugin)1 AuthenticationPluginHandler (io.confluent.ksql.api.auth.AuthenticationPluginHandler)1 KsqlAuthorizationProviderHandler (io.confluent.ksql.api.auth.KsqlAuthorizationProviderHandler)1 SystemAuthenticationHandler (io.confluent.ksql.api.auth.SystemAuthenticationHandler)1 KsqlSecurityExtension (io.confluent.ksql.security.KsqlSecurityExtension)1 Handler (io.vertx.core.Handler)1 AuthHandler (io.vertx.ext.web.handler.AuthHandler)1 BasicAuthHandler (io.vertx.ext.web.handler.BasicAuthHandler)1