Skip to content

[backport camel-4.18.x] CAMEL-24319: camel-keycloak - add optional token type (typ) and authorized party (azp) validation (#25259) - #25307

Merged
oscerd merged 1 commit into
apache:camel-4.18.xfrom
oscerd:backport/CAMEL-24319-4.18.x
Aug 3, 2026
Merged

[backport camel-4.18.x] CAMEL-24319: camel-keycloak - add optional token type (typ) and authorized party (azp) validation (#25259)#25307
oscerd merged 1 commit into
apache:camel-4.18.xfrom
oscerd:backport/CAMEL-24319-4.18.x

Conversation

@oscerd

@oscerd oscerd commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Backport of #25259 (CAMEL-24319) to camel-4.18.x, following the sibling expectedAudience opt-in that was backported to 4.18.4 (CAMEL-23875, #24540).

Adds two opt-in, default-off settings to KeycloakSecurityPolicy:

  • expectedTokenTypes — allow-list of accepted typ values (guards against token-type confusion, e.g. an ID/refresh token used as an access token)
  • expectedAuthorizedParty — expected azp value (token issued for the expected client)

Both are enforced on all three token-validation paths (authenticateToken, validateRoles, validatePermissions), for both local JWT verification and token introspection — including the validatePermissions coverage that gnodet's review of #25259 added.

Non-breaking (disabled by default). Tests green (KeycloakSecurityHelperTest 27, KeycloakSecurityProcessorTest 11). The documentation page is main-only, so no doc change here (consistent with the 4.18.x aud backport).

Jira: https://issues.apache.org/jira/browse/CAMEL-24319


Authored by Claude Code on behalf of Andrea Cosentino.

🤖 Generated with Claude Code

…ken type (typ) and authorized party (azp) validation (apache#25259)

Opt-in expectedTokenTypes + expectedAuthorizedParty on KeycloakSecurityPolicy,
applied on all three token-validation paths (authenticateToken, validateRoles,
validatePermissions) for both local JWT verification and token introspection.
Disabled by default (non-breaking). The documentation page is main-only.

(cherry picked from commit bb4922598c39fef67b39f3a56b6b17b1a0e5b0c8)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@oscerd
oscerd requested review from Croway and gnodet August 3, 2026 09:45

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

This review was generated by Claude Code, an AI assistant, on behalf of @gnodet.

Clean backport of #25259 (CAMEL-24319) to camel-4.18.x. The original PR was reviewed and approved by @gnodet and @apupier before merge on 2026-07-31.

Single-commit cherry-pick — changes are identical to the merged original. The security enhancement (opt-in expectedTokenTypes and expectedAuthorizedParty validation in KeycloakSecurityPolicy) is appropriate for backport alongside the sibling expectedAudience feature already in 4.18.4.

LGTM.

@oscerd oscerd added the enhancement New feature or request label Aug 3, 2026
@oscerd oscerd self-assigned this Aug 3, 2026
@oscerd oscerd added this to the 4.18.4 milestone Aug 3, 2026
@oscerd
oscerd merged commit 895b764 into apache:camel-4.18.x Aug 3, 2026
3 checks passed
@oscerd
oscerd deleted the backport/CAMEL-24319-4.18.x branch August 3, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants