- 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.
34 lines
1.4 KiB
Go
34 lines
1.4 KiB
Go
package oauth
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/yaoapp/yao/openapi/oauth/types"
|
|
)
|
|
|
|
// Register registers a new OAuth client with the authorization server
|
|
func (s *Service) Register(ctx context.Context, clientInfo *types.ClientInfo) (*types.ClientInfo, error) {
|
|
return s.clientProvider.CreateClient(ctx, clientInfo)
|
|
}
|
|
|
|
// UpdateClient updates an existing OAuth client configuration
|
|
func (s *Service) UpdateClient(ctx context.Context, clientID string, clientInfo *types.ClientInfo) (*types.ClientInfo, error) {
|
|
return s.clientProvider.UpdateClient(ctx, clientID, clientInfo)
|
|
}
|
|
|
|
// DeleteClient removes an OAuth client from the authorization server
|
|
func (s *Service) DeleteClient(ctx context.Context, clientID string) error {
|
|
return s.clientProvider.DeleteClient(ctx, clientID)
|
|
}
|
|
|
|
// ValidateScope validates requested scopes against available scopes
|
|
func (s *Service) ValidateScope(ctx context.Context, requestedScopes []string, clientID string) (*types.ValidationResult, error) {
|
|
return s.clientProvider.ValidateScope(ctx, clientID, requestedScopes)
|
|
}
|
|
|
|
// DynamicClientRegistration handles dynamic client registration
|
|
// This implements RFC 7591 for automatic client registration
|
|
func (s *Service) DynamicClientRegistration(ctx context.Context, request *types.DynamicClientRegistrationRequest) (*types.DynamicClientRegistrationResponse, error) {
|
|
// TODO: Implement dynamic client registration
|
|
return nil, nil
|
|
}
|