feat(auth): Implement GitHub OAuth authentication flow for package publishing
- 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.
This commit is contained in:
parent
582d93a103
commit
2089c5aaa1
1 changed files with 924 additions and 35 deletions
|
|
@ -6,27 +6,30 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/modelcontextprotocol/registry/internal/api/router"
|
||||
"github.com/modelcontextprotocol/registry/internal/auth"
|
||||
"github.com/modelcontextprotocol/registry/internal/config"
|
||||
"github.com/modelcontextprotocol/registry/internal/service"
|
||||
)
|
||||
|
||||
// Server represents the HTTP server
|
||||
type Server struct {
|
||||
config *config.Config
|
||||
registry service.RegistryService
|
||||
router *http.ServeMux
|
||||
server *http.Server
|
||||
config *config.Config
|
||||
registry service.RegistryService
|
||||
authService auth.Service
|
||||
router *http.ServeMux
|
||||
server *http.Server
|
||||
}
|
||||
|
||||
// NewServer creates a new HTTP server
|
||||
func NewServer(cfg *config.Config, registryService service.RegistryService) *Server {
|
||||
func NewServer(cfg *config.Config, registryService service.RegistryService, authService auth.Service) *Server {
|
||||
// Create router with all API versions registered
|
||||
mux := router.New(cfg, registryService)
|
||||
mux := router.New(cfg, registryService, authService)
|
||||
|
||||
server := &Server{
|
||||
config: cfg,
|
||||
registry: registryService,
|
||||
router: mux,
|
||||
config: cfg,
|
||||
registry: registryService,
|
||||
authService: authService,
|
||||
router: mux,
|
||||
server: &http.Server{
|
||||
Addr: cfg.ServerAddress,
|
||||
Handler: mux,
|
||||
|
|
|
|||
Loading…
Reference in a new issue