- Added authentication service and GitHub OAuth integration. - Introduced new authentication methods and structures in the model. - Updated the API to handle authentication during the publishing process. - Created handlers for starting and checking the status of the OAuth flow. - Enhanced the publish handler to validate authentication credentials. - Updated configuration to include GitHub OAuth settings. - Added tests for the OAuth flow and publishing with authentication. - Updated documentation to reflect changes in the API and authentication process.
28 lines
1 KiB
Go
28 lines
1 KiB
Go
// Package auth provides authentication mechanisms for the MCP registry
|
|
package auth
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/modelcontextprotocol/registry/internal/model"
|
|
)
|
|
|
|
var (
|
|
// ErrAuthRequired is returned when authentication is required but not provided
|
|
ErrAuthRequired = errors.New("authentication required")
|
|
// ErrUnsupportedAuthMethod is returned when an unsupported auth method is used
|
|
ErrUnsupportedAuthMethod = errors.New("unsupported authentication method")
|
|
)
|
|
|
|
// Service defines the authentication service interface
|
|
type Service interface {
|
|
// StartAuthFlow initiates an authentication flow and returns the flow information
|
|
StartAuthFlow(ctx context.Context, method model.AuthMethod, repoRef string) (map[string]string, string, error)
|
|
|
|
// CheckAuthStatus checks the status of an authentication flow using a status token
|
|
CheckAuthStatus(ctx context.Context, statusToken string) (string, error)
|
|
|
|
// ValidateAuth validates the authentication credentials
|
|
ValidateAuth(ctx context.Context, auth model.Authentication) (bool, error)
|
|
}
|