DeepSeek V4 Pro · Balanced
implement-access-token-context-encoding-framework-keycloak
Keycloak · Java · L · 300–799 lines · 6 files
The normal review, with one generalist agent. Judge: Claude Opus 5.5.
- Gold bugs found
- 2 of 5
- Comments published
- 3
- Comments matching a bug
- 2
- Comments not matching
- 1
- Cost of this PR
- $0.494
Published comments (3)
Abstract getShortcut() breaks binary compatibility for existing grant factories — Pre-existing grant factories compiled against older Keycloak versions will throw `AbstractMethodError` when `DefaultTokenContextEncoderProviderFactory.postInit` calls `getShortcut()`, breaking all access-token issuance. Make `getShortcut()` a `default` method so existing providers remain compatible.
isAccessTokenId matcher never verifies grant shortcut — The matcher never rejects a non-matching grant shortcut because `substring(3, 5)` reads the wrong indexes and the condition is inverted, so it only validates the UUID part. Use `substring(4, 6)` and return false when it does not equal `expectedGrantShortcut`.
Client-credentials access tokens are encoded with grant type 'na' instead of 'cc' — Tokens minted for this grant type carry `na` instead of `cc` because `ClientCredentialsGrantType.process` never sets `Constants.GRANT_TYPE` on `clientSessionCtx`. Set it to `OAuth2Constants.CLIENT_CREDENTIALS` before calling token generation.