Skip to content

Make TokenUtil Jackson-agnostic to fix upstream Keycloak Client nightly sync - #51886

Merged
mposolda merged 1 commit into
keycloak:mainfrom
michalvavrik:fix/issues/51884
Aug 20, 2026
Merged

mposolda merged 1 commit into
keycloak:mainfrom
michalvavrik:fix/issues/51884

Conversation

@michalvavrik

@michalvavrik michalvavrik commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Copilot AI balanced review requested due to automatic review settings August 20, 2026 10:27
@michalvavrik
michalvavrik requested a review from a team as a code owner August 20, 2026 10:27

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 TokenUtil Jackson-version-agnostic to restore Keycloak Client nightly synchronization and prevent regressions.

Changes:

  • Replaces JsonSerialization usage with KeycloakJsonMapper.
  • Extends Jackson-agnostic source checks to cover TokenUtil.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
core/src/main/java/org/keycloak/util/TokenUtil.java Uses the agnostic mapper for role conversion.
core/src/test/java/org/keycloak/json/JacksonAgnosticClassesTest.java Generalizes checks and adds TokenUtil enforcement.
core/src/test/java/org/keycloak/json/JacksonAgnosticRepresentationsTest.java Removed in favor of the generalized test.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings August 20, 2026 10:29

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

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

Suppressed comments (1)

core/src/test/java/org/keycloak/json/JacksonAgnosticClassesTest.java:67

  • This filter hard-codes /, while Path.toString() in addViolation uses the platform separator. On Windows every TokenUtil violation is therefore filtered out and this enforcement test always passes; construct the expected relative path with Paths instead.
        List<String> tokenUtilViolations = violations.stream().filter(v -> v.contains("util/TokenUtil.java")).collect(Collectors.toList());

Copilot AI review requested due to automatic review settings August 20, 2026 10:31
closes: keycloak#51884

Signed-off-by: Michal Vavřík <dev@michalvavrik.net>

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

core/src/test/java/org/keycloak/json/JacksonAgnosticClassesTest.java:67

  • This filter assumes Unix path separators, but Path.toString() produces backslashes on Windows, causing tokenUtilViolations to stay empty and the enforcement test to pass even when TokenUtil has violations. Normalize the recorded path before matching.
        List<String> tokenUtilViolations = violations.stream().filter(v -> v.contains("util/TokenUtil.java")).collect(Collectors.toList());

Copilot AI review requested due to automatic review settings August 20, 2026 10:34

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

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

@mposolda mposolda 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.

@michalvavrik Thanks

@mposolda mposolda self-assigned this Aug 20, 2026
@mposolda
mposolda merged commit e0530ed into keycloak:main Aug 20, 2026
94 checks passed
@michalvavrik
michalvavrik deleted the fix/issues/51884 branch August 20, 2026 13:07
@michalvavrik
michalvavrik removed the request for review from pskopek August 20, 2026 13:08
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.

Enforce Jackson-agnostic TokelUtil

3 participants