MCPcopy
hub / github.com/dosco/graphjin / AuthProvider

Interface AuthProvider

core/openapi/auth.go:26–29  ·  view source on GitHub ↗

AuthProvider attaches authentication to outgoing requests to an upstream API. Implementations are constructed once per spec at boot time and reused across every operation against that spec. Apply mutates req in place. The hdrIn parameter carries headers from the *incoming* GraphJin request, enablin

Source from the content-addressed store, hash-verified

24// retry once. Stateless providers (bearer with literal token, basic
25// auth) implement this as a no-op.
26type AuthProvider interface {
27 Apply(ctx context.Context, req *http.Request, hdrIn http.Header) error
28 OnUnauthorized(ctx context.Context) error
29}
30
31// NewAuthProvider builds the right AuthProvider for cfg.Scheme. An empty
32// or unrecognised scheme returns the no-op provider — operations against

Callers 10

TestNoopAuthFunction · 0.95
TestBearerAuthStaticFunction · 0.95
TestBasicAuthFunction · 0.95
TestApiKeyAuthHeaderFunction · 0.95
TestApiKeyAuthQueryFunction · 0.95
TestTokenExchangeFunction · 0.95
CallMethod · 0.65

Implementers 7

recordingAuthcore/openapi/caller_test.go
oauth2CCAuthcore/openapi/auth_token.go
tokenExchangeAuthcore/openapi/auth_token.go
noopAuthcore/openapi/auth.go
bearerAuthcore/openapi/auth.go
basicAuthcore/openapi/auth.go
apiKeyAuthcore/openapi/auth.go

Calls

no outgoing calls

Tested by

no test coverage detected