8000 Make JWT client validators extensible by puneetdixit200 · Pull Request #49046 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Make JWT client validators extensible - #49046

Merged
rmartinc merged 3 commits into
keycloak:mainfrom
puneetdixit200:49040-jwt-client-validator-extensibility
May 28, 2026
Merged

rmartinc merged 3 commits into
keycloak:mainfrom
puneetdixit200:49040-jwt-client-validator-extensibility

Conversation

@puneetdixit200
@puneetdixit200 puneetdixit200 commented May 17, 2026 •
Copy link
Copy Markdown
Contributor

Closes #49040

Summary

  • Change the remaining private validation helper methods in AbstractJWTClientValidator to protected so downstream
    validators can override individual validation steps instead of copying the full class.
  • Add a compile-time extensibility test covering subclasses of both AbstractJWTClientValidator and
    FederatedJWTClientValidator.
  • Preserve existing validator behavior and public API; this is a visibility-only change.

Testing

  • ./mvnw -pl services -am -Dtest=JWTClientValidatorExtensibilityTest test
  • ./mvnw -pl services spotless:check

AI agent usage

  • Used an AI coding agent to prepare this patch; I reviewed the changes and verification output.

Expose JWT client validator validation helpers to subclasses so downstream integrations can customize individual validation steps without copying the full validator implementation.

Closes keycloak#49040

Signed-off-by: Puneet Dixit <rvit23bcs086.rvitm@rvei.edu.in>
Copilot AI review requested due to automatic review settings May 17, 2026 08:57
@puneetdixit200
puneetdixit200 requested a review from a team as a code owner May 17, 2026 08:57
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Makes select helper methods on AbstractJWTClientValidator protected so integrators can override individual validation steps without forking the entire class, and adds a compile-time test that subclasses both AbstractJWTClientValidator and FederatedJWTClientValidator to lock in the new extensibility surface.

Changes:

  • Change visibility of validateClientAssertionParameters, validateClient, validateSignature, and both failure(...) helpers from private to protected.
  • Add JWTClientValidatorExtensibilityTest that subclasses both validators and overrides the now-protected/abstract methods to guarantee they remain extensible.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
services/src/main/java/org/keycloak/authentication/authenticators/client/AbstractJWTClientValidator.java Widens visibility of 5 helper methods from private to protected.
services/src/test/java/org/keycloak/authentication/authenticators/client/JWTClientValidatorExtensibilityTest.java New compile-time test asserting both validators can be subclassed and overridden.

@slaskawi slaskawi left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work @puneetdixit200 !

I added a few comments that might be worth addressing before moving on.

@puneetdixit200
puneetdixit200 force-pushed the 49040-jwt-client-validator-extensibility branch 2 times, most recently from e316b0f to b0d6af1 Compare May 20, 2026 14:46
Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
@puneetdixit200
puneetdixit200 force-pushed the 49040-jwt-client-validator-extensibility branch from b0d6af1 to dd8bfa2 Compare May 23, 2026 14:35
@puneetdixit200
Copy link
Copy Markdown
Contributor Author

Addressed the requested compile-time API stability comment on the extensibility test subclass.

Verification:

  • JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home ./mvnw -pl services -am -Dtest=JWTClientValidatorExtensibilityTest test
  • JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home ./mvnw -pl services spotless:check

@slaskawi
Copy link
8000 Copy Markdown
Contributor

Looks good to me! Thanks for great work @puneetdixit200 !

@slaskawi
Copy link
Copy Markdown
Contributor

Hey @mabartos @mposolda 👋🏻

Could I ask you to have a quick peek on this one?

@mabartos mabartos left a comment •
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@puneetdixit200 LGTM, but I think the test is not necessary. Please remove it.

@slaskawi Thanks for the review.

The validator method visibility change is enough for the extension point, and reviewers asked to drop the compile-time test.

Generated-by: OpenAI Codex

Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
@puneetdixit200
Copy link
Copy Markdown
Contributor Author

Removed the extensibility test in 331443e as requested, leaving the PR diff to just the AbstractJWTClientValidator visibility changes.

Verification:

  • git diff --check HEAD^..HEAD
  • merge-base diff now shows one changed file: services/src/main/java/org/keycloak/authentication/authenticators/client/AbstractJWTClientValidator.java

@slaskawi
Copy link
Copy Markdown
Contributor

@mposolda @ahus1 Could I ask for review/merge this one? Thank you!

@rmartinc rmartinc left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mabartos and @slaskawi!

@rmartinc
rmartinc merged commit 394c1d7 into keycloak:main May 28, 2026
87 checks passed
@stianst stianst mentioned this pull request Jun 1, 2026
sashyo pushed a commit to tide-foundation/keycloak-IGA that referenced this pull request Jul 20, 2026
* Make JWT client validators extensible

Expose JWT client validator validation helpers to subclasses so downstream integrations can customize individual validation steps without copying the full validator implementation.

Closes keycloak#49040

Signed-off-by: Puneet Dixit <rvit23bcs086.rvitm@rvei.edu.in>

* Simplify validator extensibility test

Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>

* Remove validator extensibility test

The validator method visibility change is enough for the extension point, and reviewers asked to drop the compile-time test.

Generated-by: OpenAI Codex

Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>

---------

Signed-off-by: Puneet Dixit <rvit23bcs086.rvitm@rvei.edu.in>
Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
Co-authored-by: Puneet Dixit <rvit23bcs086.rvitm@rvei.edu.in>
Co-authored-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make AbstractJWTClientValidator / FederatedJWTClientValidator methods protected for extensibility

6 participants

0