MCPcopy
hub / github.com/github/github-mcp-server / NewAuthHandler

Function NewAuthHandler

pkg/http/oauth/oauth.go:76–93  ·  view source on GitHub ↗

NewAuthHandler creates a new OAuth auth handler.

(cfg *Config, apiHost utils.APIHostResolver)

Source from the content-addressed store, hash-verified

74
75// NewAuthHandler creates a new OAuth auth handler.
76func NewAuthHandler(cfg *Config, apiHost utils.APIHostResolver) (*AuthHandler, error) {
77 if cfg == nil {
78 cfg = &Config{}
79 }
80
81 if apiHost == nil {
82 var err error
83 apiHost, err = utils.NewAPIHost("https://api.github.com")
84 if err != nil {
85 return nil, fmt.Errorf("failed to create default API host: %w", err)
86 }
87 }
88
89 return &AuthHandler{
90 cfg: cfg,
91 apiHost: apiHost,
92 }, nil
93}
94
95// routePatterns defines the route patterns for OAuth protected resource metadata.
96var routePatterns = []string{

Callers 6

RunHTTPServerFunction · 0.92
TestNewAuthHandlerFunction · 0.85
TestRegisterRoutesFunction · 0.85

Calls 1

NewAPIHostFunction · 0.92