Skip to content

feat(build): extract authmgr-oauth2-agent module with no Iceberg dependency - #241

Draft
adutra wants to merge 2 commits into
dremio:mainfrom
adutra:authmgr-agent
Draft

feat(build): extract authmgr-oauth2-agent module with no Iceberg dependency#241
adutra wants to merge 2 commits into
dremio:mainfrom
adutra:authmgr-agent

Conversation

@adutra

@adutra adutra commented May 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #239.

Introduces a new :authmgr-oauth2-agent Gradle module containing the entire OAuth2 token engine (OAuth2Agent, all Flow implementations, OAuth2Config, and every supporting subpackage) with zero Iceberg compile-time dependencies, making it usable by non-Iceberg callers (custom REST clients, Kafka connectors, ad-hoc tooling).

:authmgr-oauth2-core is now a thin two-class Iceberg SPI adapter (OAuth2Manager + OAuth2Session). Bundle modules (runtime, standalone) continue to shadow :authmgr-oauth2-core and pick up the agent transitively; their sources/javadoc JARs now merge both modules.

Test fixtures are split accordingly: agent testFixtures contain the Iceberg-free TestEnvironment and all expectation helpers; core testFixtures add IcebergTestEnvironment extends TestEnvironment and IcebergRestExpectation for the two Iceberg-specific catalog mocks.

The new :authmgr-oauth2-agent module now has a new root package: com.dremio.iceberg.authmgr.oauth2.agent. The existing :authmgr-oauth2-core keeps its current package:
com.dremio.iceberg.authmgr.oauth2, in order to avoid user-facing regressions since this module contains the Auth Manager implementation.

@@ -161,6 +161,6 @@ void testReadPemWithInvalidBase64() throws IOException {
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Failed to read PEM file")
.rootCause()
.hasMessageContaining("not enough content");
.hasMessageContaining("Illegal base64 character");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are now using the JDK decoder, not Apache Commons brought transitively by Iceberg.

@SuppressWarnings("resource")
public PolarisContainer() {
super("apache/polaris:1.3.0-incubating");
super("apache/polaris:1.5.0");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but quite consensual I hope :-)

* limitations under the License.
*/
package com.dremio.iceberg.authmgr.oauth2.config.validator;
package com.dremio.iceberg.authmgr.oauth2.agent.config.validator;

@dimas-b dimas-b May 22, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this module is not supposed to have Iceberg deps, having iceberg in the package name looks odd 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely agree, but changing the root package name also feels odd, in a project where all modules share the com.dremio.iceberg.authmgr root package.

A possible solution would be to repurpose this repository into something like "Dremio OAuth2 Tools", containing 2 main components: the (iceberg-agnostic) agent and the Iceberg-specific AuthManager.

WDYT? Should I move forward with the idea of rebranding this repo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also a problem with Maven GAV coordinates: the group ID for all modules is com.dremio.iceberg.authmgr. Changing the group ID would require publishing relocation poms for existing modules.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I investigated this matter a bit more today and came to the conclusion that this change needs more thinking. A few things that we also need to consider:

  • What Maven GAV coordinates should we use for the new module?
  • What root package?
  • What Gradle module name (knowning that the Gradle module name by default becomes the Maven artifact ID)?
  • Should we repurpose authmgr-oauth2-immutables as well (since it's used by the Agent)?
  • Should we keep the BOM global, or make it an Iceberg-specific BOM?
  • How to re-organize the repository's folder structure?
  • How to re-organize the docs folder?
  • And maybe the most tricky item: com.dremio.oauth2.agent.OAuth2AgentConfig#PREFIX references the Iceberg's AuthManager config prefix statically, and is not configurable atm. We would need to make this prefix configurable at runtime.

Given all the above questions, let's put this PR into draft state for now and solve them little by little.

…ndency

Fixes dremio#239.

Introduces a new `:authmgr-oauth2-agent` Gradle module containing the
entire OAuth2 token engine (`OAuth2Agent`, all `Flow` implementations,
`OAuth2Config`, and every supporting subpackage) with zero Iceberg
compile-time dependencies, making it usable by non-Iceberg callers
(custom REST clients, Kafka connectors, ad-hoc tooling).

`:authmgr-oauth2-core` is now a thin two-class Iceberg SPI adapter
(`OAuth2Manager` + `OAuth2Session`). Bundle modules (`runtime`,
`standalone`) continue to shadow `:authmgr-oauth2-core` and pick up the
agent transitively; their sources/javadoc JARs now merge both modules.

Test fixtures are split accordingly: agent `testFixtures` contain the
Iceberg-free `TestEnvironment` and all expectation helpers; core
`testFixtures` add `IcebergTestEnvironment extends TestEnvironment` and
`IcebergRestExpectation` for the two Iceberg-specific catalog mocks.

The new `:authmgr-oauth2-agent` module now has a new root package:
`com.dremio.iceberg.authmgr.oauth2.agent`. The existing
`:authmgr-oauth2-core` keeps its current package:
`com.dremio.iceberg.authmgr.oauth2`, in order to avoid user-facing
regressions since this module contains the Auth Manager implementation.
@adutra
adutra marked this pull request as draft May 25, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Extract OAuth2Agent to a separate module

2 participants