ATLAS-5401: client configuration to support custom token supplier - #752
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Adds support for configuring a custom JWT token supplier for Atlas clients via atlas.rest.auth.token.supplier, while keeping the default JWT sourcing behavior working.
Changes:
- Replaces the internal
TokenRetrieverabstraction withSupplier<String>for JWT retrieval. - Adds reflective instantiation of a configured token supplier class (with optional
Configurationconstructor). - Adds unit tests covering default and custom supplier wiring.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| client/common/src/main/java/org/apache/atlas/token/retriever/TokenRetriever.java | Removes the old token retriever interface in favor of Supplier. |
| client/common/src/main/java/org/apache/atlas/token/retriever/JwTokenRetrieverDefault.java | Converts default JWT retriever to Supplier<String> and adapts retrieval flow. |
| client/common/src/main/java/org/apache/atlas/AtlasBaseClient.java | Adds config-driven token supplier loading and uses it for JWT header injection. |
| client/client-v2/src/test/java/org/apache/atlas/AtlasClientV2Test.java | Adds tests for default/custom token supplier initialization. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Changes looks good. I tested the AtlasClient In IntegrationTest with all variants of JWT token inputs such as -
testBasicAuth
- testJwtFromFile
- testJwtFromEnv
- testCustomTokenSupplier
it looks good.
@Test
public void testCustomTokenSupplier() throws Exception {
Configuration configuration = new BaseConfiguration();
configuration.setProperty("atlas.rest.auth.token.supplier", StaticJwtSupplier.class.getName());
StaticJwtSupplier.TOKEN = jwtToken;
AtlasClientV2 client = new AtlasClientV2(configuration, new String[] {ATLAS_URL}, null);
assertTrue(client.isServerReady(), "isServerReady() should succeed with custom token supplier");
}
public static class StaticJwtSupplier implements Supplier<String> {
static String TOKEN;
@Override
public String get() {
return TOKEN;
}
}
…er (#752) * ATLAS-5401: Atlas client configuration to support custom token supplier
What changes were proposed in this pull request?
Updated Atlas client for applications to register a customer JWT token provider - using configuration
atlas.rest.auth.token.supplier.How was this patch tested?