Skip to content

Commit 89665bb

Browse files
feat: make clientAuthenticationMethod configurable in Druid 35.0.1 (#1431)
* feat: make clientAuthenticationMethod configurable in Druid 35.0.1 * chore: changelog * Update CHANGELOG.md Co-authored-by: Malte Sander <malte.sander.it@gmail.com> --------- Co-authored-by: Malte Sander <malte.sander.it@gmail.com>
1 parent 3a04f88 commit 89665bb

2 files changed

Lines changed: 124 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ All notable changes to this project will be documented in this file.
2424
- hbase: Add `2.6.4` (and phoenix `5.3.0`) ([#1408]).
2525
- spark: Add `3.5.8` ([#1414]).
2626
- spark-connect-client: Add `3.5.8` ([#1414]).
27-
- hbase: Backport HBASE-29797 to all HBAse versions (`2.6.3` and `2.6.4`) ([#1425]).
27+
- hbase: Backport HBASE-29797 to all HBase versions (`2.6.3` and `2.6.4`) ([#1425]).
28+
- druid: Make the `clientAuthenticationMethod` configurable in Druid `35.0.1` ([#1431]).
2829
- ubi10-rust-builder: Add new ubi10 base image for operators to begin using ([#1432]).
2930

3031
### Changed
@@ -119,6 +120,7 @@ All notable changes to this project will be documented in this file.
119120
[#1426]: https://github.com/stackabletech/docker-images/pull/1426
120121
[#1428]: https://github.com/stackabletech/docker-images/pull/1428
121122
[#1429]: https://github.com/stackabletech/docker-images/pull/1429
123+
[#1431]: https://github.com/stackabletech/docker-images/pull/1431
122124
[#1432]: https://github.com/stackabletech/docker-images/pull/1432
123125
[#1433]: https://github.com/stackabletech/docker-images/pull/1433
124126
[#1435]: https://github.com/stackabletech/docker-images/pull/1435
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
From c2426a9169f22bd9b955bcde779ce2c248b5f8c0 Mon Sep 17 00:00:00 2001
2+
From: dervoeti <lukas.krug@stackable.tech>
3+
Date: Thu, 5 Feb 2026 15:00:23 +0100
4+
Subject: feat: add configurable clientAuthenticationMethod to druid-pac4j OIDC
5+
config
6+
7+
---
8+
.../druid/security/pac4j/OIDCConfig.java | 13 ++++++++-
9+
.../security/pac4j/Pac4jAuthenticator.java | 5 ++++
10+
.../druid/security/pac4j/OIDCConfigTest.java | 28 +++++++++++++++++++
11+
3 files changed, 45 insertions(+), 1 deletion(-)
12+
13+
diff --git a/extensions-core/druid-pac4j/src/main/java/org/apache/druid/security/pac4j/OIDCConfig.java b/extensions-core/druid-pac4j/src/main/java/org/apache/druid/security/pac4j/OIDCConfig.java
14+
index 50b04455db..d83e04717a 100644
15+
--- a/extensions-core/druid-pac4j/src/main/java/org/apache/druid/security/pac4j/OIDCConfig.java
16+
+++ b/extensions-core/druid-pac4j/src/main/java/org/apache/druid/security/pac4j/OIDCConfig.java
17+
@@ -44,13 +44,17 @@ public class OIDCConfig
18+
@JsonProperty
19+
private final String scope;
20+
21+
+ @JsonProperty
22+
+ private final String clientAuthenticationMethod;
23+
+
24+
@JsonCreator
25+
public OIDCConfig(
26+
@JsonProperty("clientID") String clientID,
27+
@JsonProperty("clientSecret") PasswordProvider clientSecret,
28+
@JsonProperty("discoveryURI") String discoveryURI,
29+
@JsonProperty("oidcClaim") String oidcClaim,
30+
- @JsonProperty("scope") @Nullable String scope
31+
+ @JsonProperty("scope") @Nullable String scope,
32+
+ @JsonProperty("clientAuthenticationMethod") @Nullable String clientAuthenticationMethod
33+
)
34+
{
35+
this.clientID = Preconditions.checkNotNull(clientID, "null clientID");
36+
@@ -58,6 +62,7 @@ public class OIDCConfig
37+
this.discoveryURI = Preconditions.checkNotNull(discoveryURI, "null discoveryURI");
38+
this.oidcClaim = oidcClaim == null ? DEFAULT_SCOPE : oidcClaim;
39+
this.scope = scope;
40+
+ this.clientAuthenticationMethod = clientAuthenticationMethod;
41+
}
42+
43+
@JsonProperty
44+
@@ -89,4 +94,10 @@ public class OIDCConfig
45+
{
46+
return scope;
47+
}
48+
+
49+
+ @JsonProperty
50+
+ public String getClientAuthenticationMethod()
51+
+ {
52+
+ return clientAuthenticationMethod;
53+
+ }
54+
}
55+
diff --git a/extensions-core/druid-pac4j/src/main/java/org/apache/druid/security/pac4j/Pac4jAuthenticator.java b/extensions-core/druid-pac4j/src/main/java/org/apache/druid/security/pac4j/Pac4jAuthenticator.java
56+
index ef30f4c7e6..59a6fa0782 100644
57+
--- a/extensions-core/druid-pac4j/src/main/java/org/apache/druid/security/pac4j/Pac4jAuthenticator.java
58+
+++ b/extensions-core/druid-pac4j/src/main/java/org/apache/druid/security/pac4j/Pac4jAuthenticator.java
59+
@@ -27,6 +27,7 @@ import com.google.common.base.Supplier;
60+
import com.google.common.base.Suppliers;
61+
import com.google.common.primitives.Ints;
62+
import com.google.inject.Provider;
63+
+import com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod;
64+
import com.nimbusds.oauth2.sdk.http.HTTPRequest;
65+
import org.apache.druid.server.security.AuthenticationResult;
66+
import org.apache.druid.server.security.Authenticator;
67+
@@ -132,6 +133,10 @@ public class Pac4jAuthenticator implements Authenticator
68+
oidcConf.setSecret(oidcConfig.getClientSecret().getPassword());
69+
oidcConf.setDiscoveryURI(oidcConfig.getDiscoveryURI());
70+
oidcConf.setScope(oidcConfig.getScope());
71+
+ if (oidcConfig.getClientAuthenticationMethod() != null) {
72+
+ oidcConf.setClientAuthenticationMethod(
73+
+ ClientAuthenticationMethod.parse(oidcConfig.getClientAuthenticationMethod()));
74+
+ }
75+
oidcConf.setExpireSessionWithToken(true);
76+
oidcConf.setUseNonce(true);
77+
oidcConf.setReadTimeout(Ints.checkedCast(pac4jCommonConfig.getReadTimeout().getMillis()));
78+
diff --git a/extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/OIDCConfigTest.java b/extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/OIDCConfigTest.java
79+
index c4192c020d..0b6128e61b 100644
80+
--- a/extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/OIDCConfigTest.java
81+
+++ b/extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/OIDCConfigTest.java
82+
@@ -46,6 +46,7 @@ public class OIDCConfigTest
83+
Assert.assertEquals("testdiscoveryuri", conf.getDiscoveryURI());
84+
Assert.assertEquals("name", conf.getOidcClaim());
85+
Assert.assertEquals("testscope", conf.getScope());
86+
+ Assert.assertNull(conf.getClientAuthenticationMethod());
87+
}
88+
89+
@Test
90+
@@ -72,4 +73,31 @@ public class OIDCConfigTest
91+
Assert.assertEquals("email", conf.getOidcClaim());
92+
Assert.assertEquals("testscope", conf.getScope());
93+
}
94+
+
95+
+ @Test
96+
+ public void testSerdeWithClientAuthenticationMethod() throws Exception
97+
+ {
98+
+ ObjectMapper jsonMapper = new ObjectMapper();
99+
+
100+
+ String jsonStr = "{\n"
101+
+ + " \"clientID\": \"testid\",\n"
102+
+ + " \"clientSecret\": \"testsecret\",\n"
103+
+ + " \"discoveryURI\": \"testdiscoveryuri\",\n"
104+
+ + " \"oidcClaim\": \"email\",\n"
105+
+ + " \"scope\": \"testscope\",\n"
106+
+ + " \"clientAuthenticationMethod\": \"client_secret_post\"\n"
107+
+ + "}\n";
108+
+
109+
+ OIDCConfig conf = jsonMapper.readValue(
110+
+ jsonMapper.writeValueAsString(jsonMapper.readValue(jsonStr, OIDCConfig.class)),
111+
+ OIDCConfig.class
112+
+ );
113+
+
114+
+ Assert.assertEquals("testid", conf.getClientID());
115+
+ Assert.assertEquals("testsecret", conf.getClientSecret().getPassword());
116+
+ Assert.assertEquals("testdiscoveryuri", conf.getDiscoveryURI());
117+
+ Assert.assertEquals("email", conf.getOidcClaim());
118+
+ Assert.assertEquals("testscope", conf.getScope());
119+
+ Assert.assertEquals("client_secret_post", conf.getClientAuthenticationMethod());
120+
+ }
121+
}

0 commit comments

Comments
 (0)