Publish Auth Interface (#112)
This pull request introduces significant updates to the authentication system for the MCP Registry Publisher Tool. The changes focus on transitioning to an interface-based authentication system, implementing GitHub OAuth device flow as the default authentication method, and restructuring the codebase for better modularity and extensibility. Adding an interface to the publishing CLI, so that it'll be easier to add more auth methods as they become available.
This commit is contained in:
parent
2f266c7a69
commit
a4cefcf05f
1 changed files with 465 additions and 266 deletions
21
tools/publisher/auth/interface.go
Normal file
21
tools/publisher/auth/interface.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package auth
|
||||
|
||||
import "context"
|
||||
|
||||
// Provider defines the interface for authentication mechanisms
|
||||
type Provider interface {
|
||||
// GetToken retrieves or generates an authentication token
|
||||
// It returns the token string and any error encountered
|
||||
GetToken(ctx context.Context) (string, error)
|
||||
|
||||
// NeedsLogin checks if a new login is required
|
||||
// This can check for existing tokens, expiry, etc.
|
||||
NeedsLogin() bool
|
||||
|
||||
// Login performs the authentication flow
|
||||
// This might involve user interaction, device flows, etc.
|
||||
Login(ctx context.Context) error
|
||||
|
||||
// Name returns the name of the authentication provider
|
||||
Name() string
|
||||
}
|
||||
Loading…
Reference in a new issue