MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / scopesFromChallenges

Function scopesFromChallenges

auth/authorization_code.go:301–308  ·  view source on GitHub ↗

scopesFromChallenges returns the scopes from the given "WWW-Authenticate" header challenges. It only looks at challenges with the "Bearer" scheme.

(cs []oauthex.Challenge)

Source from the content-addressed store, hash-verified

299// scopesFromChallenges returns the scopes from the given "WWW-Authenticate" header challenges.
300// It only looks at challenges with the "Bearer" scheme.
301func scopesFromChallenges(cs []oauthex.Challenge) []string {
302 for _, c := range cs {
303 if c.Scheme == "bearer" && c.Params["scope"] != "" {
304 return strings.Fields(c.Params["scope"])
305 }
306 }
307 return nil
308}
309
310// errorFromChallenges returns the error from the given "WWW-Authenticate" header challenges.
311// It only looks at challenges with the "Bearer" scheme.

Callers 1

AuthorizeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…