- Deleted the OAuth interface and related types that were previously defined in the `interfaces.go` and `types.go` files, streamlining the codebase. - Updated the `oauth.go` file to integrate user and client providers directly, enhancing the service's functionality and reducing complexity. - Refactored the user information retrieval method to utilize the new user provider structure, ensuring compatibility with the updated architecture.
35 lines
1.3 KiB
Go
35 lines
1.3 KiB
Go
package oauth
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/yaoapp/yao/openapi/oauth/types"
|
|
)
|
|
|
|
// ValidateResourceParameter validates an OAuth 2.0 resource parameter
|
|
// This ensures the resource parameter is valid and properly formatted
|
|
func (s *Service) ValidateResourceParameter(ctx context.Context, resource string) (*types.ValidationResult, error) {
|
|
// TODO: Implement resource parameter validation
|
|
return nil, nil
|
|
}
|
|
|
|
// GetCanonicalResourceURI returns the canonical form of a resource URI
|
|
// This normalizes resource URIs for consistent processing
|
|
func (s *Service) GetCanonicalResourceURI(ctx context.Context, serverURI string) (string, error) {
|
|
// TODO: Implement canonical resource URI generation
|
|
return "", nil
|
|
}
|
|
|
|
// GetProtectedResourceMetadata returns OAuth 2.0 Protected Resource Metadata
|
|
// This implements RFC 9728 for MCP server discovery
|
|
func (s *Service) GetProtectedResourceMetadata(ctx context.Context) (*types.ProtectedResourceMetadata, error) {
|
|
// TODO: Implement protected resource metadata
|
|
return nil, nil
|
|
}
|
|
|
|
// HandleWWWAuthenticate processes WWW-Authenticate challenges
|
|
// This handles authentication challenges from protected resources
|
|
func (s *Service) HandleWWWAuthenticate(ctx context.Context, challenge string) (*types.WWWAuthenticateChallenge, error) {
|
|
// TODO: Implement WWW-Authenticate challenge handling
|
|
return nil, nil
|
|
}
|