-
Notifications
You must be signed in to change notification settings - Fork 170
add bearerToken type to MCPExternalAuthConfig CRD #3224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3224 +/- ##
==========================================
+ Coverage 56.97% 57.01% +0.04%
==========================================
Files 351 351
Lines 34962 34990 +28
==========================================
+ Hits 19919 19951 +32
+ Misses 13387 13378 -9
- Partials 1656 1661 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // BearerToken configures bearer token authentication | ||
| // Only used when Type is "bearerToken" | ||
| // +optional | ||
| BearerToken *BearerTokenConfig `json:"bearerToken,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have probably asked this earlier but what is the difference and overlap between HeaderInjectin and BearerToken?
jhrozek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine adding a new type as a user shortcut, but it would be nice to, at least thinking about vmCP, reuse code when converting this to a vMCP auth strategy
Summary
This PR adds bearer token authentication support to the
MCPExternalAuthConfigCRD, allowing users to configure bearer token authentication for remote MCP servers via Kubernetes Secrets.NOTE: Controller Implementation will be done in next PR
Changes
CRD Types (
cmd/thv-operator/api/v1alpha1/mcpexternalauthconfig_types.go)ExternalAuthTypeBearerTokenconstantBearerTokenConfigstruct withTokenSecretRef *SecretKeyReffieldMCPExternalAuthConfigSpecto includeBearerToken *BearerTokenConfigfieldbearerTokentypeWebhook Validation (
cmd/thv-operator/api/v1alpha1/mcpexternalauthconfig_webhook.go)bearerTokentype:BearerTokenconfig must be provided when type isbearerTokenTokenExchangeandHeaderInjectionmust not be set when type isbearerTokenBearerTokenmust not be set when type is notbearerTokenBearerTokenfieldTests (
cmd/thv-operator/api/v1alpha1/mcpexternalauthconfig_webhook_test.go)Code Generation
BearerTokenConfig)Example Usage
Security Considerations
No Plain Text: Only Kubernetes Secret references are supported
Namespace Scoped: Secrets must be in the same namespace as the MCPExternalAuthConfig
Consistent with OAuth: Follows the same security model as ClientSecretRef in token exchange
Testing
✅ All existing tests pass
✅ New bearer token validation tests pass
✅ CRD validation correctly rejects invalid configurations
✅ Deepcopy code generated successfully
Related
Part of Phase 3: Kubernetes Operator Implementation
PR 1 of 2: CRD Types and Validation (this PR)
PR 2: Controller Implementation (next)