End-to-end publish test using examples from docs (#199)
This commit is contained in:
parent
774a0df592
commit
4f5e85b510
2 changed files with 1041 additions and 919 deletions
38
internal/auth/no_auth.go
Normal file
38
internal/auth/no_auth.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
//go:build noauth
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/modelcontextprotocol/registry/internal/config"
|
||||
"github.com/modelcontextprotocol/registry/internal/model"
|
||||
)
|
||||
|
||||
func init() {
|
||||
fmt.Fprintln(os.Stderr, `WARNING: "noauth" build tag has disabled authentication`)
|
||||
}
|
||||
|
||||
// NewAuthService creates a new authentication service that does nothing. All its methods succeed unconditionally.
|
||||
func NewAuthService(*config.Config) Service {
|
||||
return &noAuth{}
|
||||
}
|
||||
|
||||
type noAuth struct{}
|
||||
|
||||
// StartAuthFlow always returns fake flow info and a fake status token
|
||||
func (*noAuth) StartAuthFlow(context.Context, model.AuthMethod, string) (map[string]string, string, error) {
|
||||
return map[string]string{"fake": "info"}, "fake-status-token", nil
|
||||
}
|
||||
|
||||
// CheckAuthStatus always returns a fake token
|
||||
func (*noAuth) CheckAuthStatus(context.Context, string) (string, error) {
|
||||
return "fake-token", nil
|
||||
}
|
||||
|
||||
// ValidateAuth always returns true
|
||||
func (*noAuth) ValidateAuth(context.Context, model.Authentication) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
//go:build !noauth
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
|
|
|
|||
Loading…
Reference in a new issue