feat(auth): implement OAuth 2.0 authorization code flow and dynamic client registration
- Add OAuth 2.0 support with authorization code flow and dynamic client registration. - Introduce new handlers for OAuth metadata, client registration, authorization, and token issuance. - Enhance authentication middleware to support OAuth client credentials. - Create in-memory stores for authorization codes and tokens. - Update configuration to include OAuth client details. - Ensure validation checks for OAuth clients in the configuration.
This commit is contained in:
@@ -36,11 +36,11 @@ type MCPConfig struct {
|
||||
}
|
||||
|
||||
type AuthConfig struct {
|
||||
Mode string `yaml:"mode"`
|
||||
HeaderName string `yaml:"header_name"`
|
||||
QueryParam string `yaml:"query_param"`
|
||||
AllowQueryParam bool `yaml:"allow_query_param"`
|
||||
Keys []APIKey `yaml:"keys"`
|
||||
HeaderName string `yaml:"header_name"`
|
||||
QueryParam string `yaml:"query_param"`
|
||||
AllowQueryParam bool `yaml:"allow_query_param"`
|
||||
Keys []APIKey `yaml:"keys"`
|
||||
OAuth OAuthConfig `yaml:"oauth"`
|
||||
}
|
||||
|
||||
type APIKey struct {
|
||||
@@ -49,6 +49,17 @@ type APIKey struct {
|
||||
Description string `yaml:"description"`
|
||||
}
|
||||
|
||||
type OAuthConfig struct {
|
||||
Clients []OAuthClient `yaml:"clients"`
|
||||
}
|
||||
|
||||
type OAuthClient struct {
|
||||
ID string `yaml:"id"`
|
||||
ClientID string `yaml:"client_id"`
|
||||
ClientSecret string `yaml:"client_secret"`
|
||||
Description string `yaml:"description"`
|
||||
}
|
||||
|
||||
type DatabaseConfig struct {
|
||||
URL string `yaml:"url"`
|
||||
MaxConns int32 `yaml:"max_conns"`
|
||||
|
||||
Reference in New Issue
Block a user