-
Notifications
You must be signed in to change notification settings - Fork 151
Refactor/typed backend auth strategy #2797
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
Conversation
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.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2797 +/- ##
==========================================
- Coverage 56.57% 56.55% -0.02%
==========================================
Files 320 320
Lines 30882 30874 -8
==========================================
- Hits 17470 17460 -10
Misses 11911 11911
- Partials 1501 1503 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d8bebfd to
43e900d
Compare
43e900d to
2b4a59e
Compare
Create a new leaf package pkg/vmcp/auth/types containing: - Strategy type constants (StrategyTypeUnauthenticated, etc.) - BackendAuthStrategy struct with typed fields (HeaderInjection, TokenExchange) - HeaderInjectionConfig and TokenExchangeConfig structs The Metadata field is retained in BackendAuthStrategy for backward compatibility - all existing code continues to work unchanged. Update all files to import BackendAuthStrategy from auth/types instead of config package. This is a structural refactoring with zero behavior change, preparing for a follow-up PR that will remove the Metadata field.
2b4a59e to
964e3fd
Compare
Remove the deprecated Metadata map[string]any field from BackendAuthStrategy and migrate all code to use typed fields (HeaderInjection, TokenExchange). Key changes: - Remove Metadata field from authtypes.BackendAuthStrategy - Update Strategy interface to accept *BackendAuthStrategy instead of map - Update all strategies (header_injection, tokenexchange, unauthenticated) - Update converters to return typed BackendAuthStrategy - Change Backend/BackendTarget structs to use AuthConfig instead of AuthStrategy + AuthMetadata - Update ResolveForBackend to return *BackendAuthStrategy - Update all consumers and tests This provides type safety, better IDE support, and eliminates runtime type assertions throughout the auth subsystem.
964e3fd to
980f0df
Compare
Large PR justification has been provided. Thank you!
|
✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review. |
- Update convertExternalAuthConfigToStrategy to use authtypes.BackendAuthStrategy - Update convertBackendAuthConfigToVMCP to use typed structures - Remove Metadata map usage in favor of typed fields (TokenExchange, HeaderInjection) - This ensures compatibility with the marshaling fix from PR #2797
…alMCPServer This PR implements the core discovery feature that allows VirtualMCPServer to automatically discover ExternalAuthConfig from MCPServers in the group and include them in the outgoing auth configuration. Changes: - Add discoverExternalAuthConfigs() to discover auth configs from MCPServers - Add buildOutgoingAuthConfig() to build outgoing auth with discovery - Add convertExternalAuthConfigToStrategy() to convert CRD to strategy - Add convertBackendAuthConfigToVMCP() to convert backend auth config - Add comprehensive test suite for discovery and conversion logic - Integration with typed BackendAuthStrategy from PR #2797 Note: Secret management for discovered ExternalAuthConfigs will be added in a follow-up PR.
remove Metadata field and use typed auth config
Remove the deprecated Metadata map[string]any field from BackendAuthStrategy and migrate all code to use typed fields (HeaderInjection, TokenExchange).
Large PR Justification
This is a refactoring that touches large number of files. I split it into 2 patches for easier review, the first one just moves constants from 1 package to another, the next patch removes