Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run REST Catalog Server with OAuth2 Authentication? #27

Open
cloudcheflabs opened this issue Mar 31, 2023 · 1 comment
Open

How to run REST Catalog Server with OAuth2 Authentication? #27

cloudcheflabs opened this issue Mar 31, 2023 · 1 comment

Comments

@cloudcheflabs
Copy link

I want to add iceberg REST catalog with the value of OAUTH2 for the option of iceberg.rest-catalog.security to my trino cluster, for which REST catalog server needs to be run with support of OAuth2 authentication.
I have added some codes at the end of RESTCatalogServer like this.

            RESTCatalogAdapter adapter = new RESTCatalogAdapter(backendCatalog());
            RESTCatalogServlet servlet = new RESTCatalogServlet(adapter);
            ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
            context.setContextPath("/");
            ServletHolder servletHolder = new ServletHolder(servlet);
            servletHolder.setInitParameter("javax.ws.rs.Application", "ServiceListPublic");
            context.addServlet(servletHolder, "/*");
            context.setVirtualHosts(null);
            context.setGzipHandler(new GzipHandler());

            Server httpServer =
                    new Server(PropertyUtil.propertyAsInt(System.getenv(), "REST_PORT", 8181));
            httpServer.setHandler(context);

            httpServer.start();

           // ADDED CODES!!!!!!!
            SessionCatalog.SessionContext sessionContext =
                    new SessionCatalog.SessionContext(
                            UUID.randomUUID().toString(),
                            "user",
                            ImmutableMap.of("credential", "user:secret"),
                            ImmutableMap.of());

            RESTCatalog catalog = new RESTCatalog(sessionContext, (config) -> adapter);
            catalog.initialize(
                    "prod", ImmutableMap.of(CatalogProperties.URI, "ignored", "token", "bearer-token"));

But it seems, this is not OAuth2 enabled server.

Anybody knows how to add OAuth2 authentication to RESTCatalogServer?

@zeddit
Copy link

zeddit commented Jan 1, 2024

@cloudcheflabs If you have any idea about how to add OAuth2 authentication to REST catalog, could you please let me know. great thanks. I am looking for this.

This repo seems a demo-like project but not the one that Tabular claimed to has the feature of lazy snapshot loading, multi-table commits, and caching and something of authentication and making make authorization decisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants