[backport camel-4.18.x] CAMEL-24319: camel-keycloak - add optional token type (typ) and authorized party (azp) validation (#25259) - #25307
Merged
Conversation
…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>
gnodet
approved these changes
Aug 3, 2026
gnodet
left a comment
Contributor
There was a problem hiding this comment.
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.
davsclaus
approved these changes
Aug 3, 2026
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.
Backport of #25259 (CAMEL-24319) to
camel-4.18.x, following the siblingexpectedAudienceopt-in that was backported to 4.18.4 (CAMEL-23875, #24540).Adds two opt-in, default-off settings to
KeycloakSecurityPolicy:expectedTokenTypes— allow-list of acceptedtypvalues (guards against token-type confusion, e.g. an ID/refresh token used as an access token)expectedAuthorizedParty— expectedazpvalue (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 thevalidatePermissionscoverage that gnodet's review of #25259 added.Non-breaking (disabled by default). Tests green (
KeycloakSecurityHelperTest27,KeycloakSecurityProcessorTest11). 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