fix(api-server): handle Keycloak service-account- prefix in OIDC username matching#1471
Closed
markturansky wants to merge 2 commits intomainfrom
Closed
fix(api-server): handle Keycloak service-account- prefix in OIDC username matching#1471markturansky wants to merge 2 commits intomainfrom
markturansky wants to merge 2 commits intomainfrom
Conversation
…name matching Keycloak client credentials tokens have preferred_username set to "service-account-<clientId>" rather than the raw client ID. The GRPC_SERVICE_ACCOUNT env var is populated from the clientId secret key (e.g. "ocm-ams-service"), but the JWT username is "service-account-ocm-ams-service". The direct comparison always failed, so CallerTypeService was never set and WatchSessionMessages returned PERMISSION_DENIED. Add isServiceAccount() helper that matches both the raw client ID and the Keycloak-prefixed form. Evidence: decoded the OIDC token from Red Hat SSO client credentials grant — preferred_username="service-account-ocm-ams-service". 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for cheerful-kitten-f556a0 canceled.
|
Contributor
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
Contributor
Author
|
Closing — this fix was already merged to main via #1465. |
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.
Summary
service-account-in JWT claims, causing the gRPC middleware to fail matching the configuredGRPC_SERVICE_ACCOUNTusername and not assigningCallerTypeService.isServiceAccount()helper that accepts both the exact configured name and the Keycloak-prefixed variant (service-account-<name>), used in both the unary and stream gRPC interceptors.Test plan
TestIsServiceAccountpasses with all 6 casesTestBearerTokenAuthand gRPC interceptor tests continue to passCallerTypeServicewith Keycloak-issued tokens🤖 Generated with Claude Code