Add configurable clientAuthenticationMethod to druid-pac4j OIDC configuration#19020
Open
dervoeti wants to merge 1 commit intoapache:masterfrom
Open
Add configurable clientAuthenticationMethod to druid-pac4j OIDC configuration#19020dervoeti wants to merge 1 commit intoapache:masterfrom
dervoeti wants to merge 1 commit intoapache:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #19019.
Description
This PR adds an optional
clientAuthenticationMethodconfiguration parameter to the druid-pac4j OIDC authentication extension, allowing users to explicitly specify the client authentication method to use with their OIDC provider.Problem: Breaking change with pac4j 5.7.3 upgrade
The upgrade of pac4j to 5.7.3 in Druid 35 introduced support for the
private_key_jwtclient authentication method (added in pac4j 5.7.0).This created a breaking change for some OIDC deployments:
pac4j 4.5.7 (Druid 34.0.0): When auto-detecting the authentication method from an OIDC provider's discovery document, pac4j would not recognize
private_key_jwtand would fall back to the next available method likeclient_secret_basic.pac4j 5.7.3 (Druid 35.0.1): pac4j now recognizes
private_key_jwtin theSUPPORTED_METHODSset. When an OIDC provider (e.g., Keycloak) advertises["private_key_jwt", "client_secret_basic", ...], pac4j selectsprivate_key_jwtas the first supported method. However, ifprivateKeyJwtConfigis not configured in the code, authentication fails with:"privateKeyJwtConfig cannot be null"This affects users whose OIDC providers advertise
private_key_jwtbut who want to use simpler authentication methods likeclient_secret_basicorclient_secret_post.Solution: Explicit configuration parameter
Added a new optional
clientAuthenticationMethodfield toOIDCConfigthat:The implementation:
clientAuthenticationMethodfield toOIDCConfigwith JSON serializationPac4jAuthenticatorto calloidcConf.setClientAuthenticationMethod()when the parameter is providedClientAuthenticationMethod.parse()from nimbus library to parse the method stringOIDCConfigTestDesign decisions
Release note
Users of the druid-pac4j OIDC authentication extension can now explicitly configure their preferred client authentication method using the new optional
clientAuthenticationMethodparameter. This resolves compatibility issues introduced with pac4j 5.7.3 where OIDC providers advertisingprivate_key_jwt(such as Keycloak) would cause authentication failures when the asymmetric JWT method was not configured.Supported values include:
client_secret_basic,client_secret_post,client_secret_jwt,private_key_jwt, andnone. If not specified, pac4j will continue to use its auto-detection behavior.Key changed/added classes in this PR
This PR has: