MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / WithCurrentUser

Function WithCurrentUser

internal/server/context.go:35–37  ·  view source on GitHub ↗

Exported context-key helpers for callers that need to synthesize an authenticated request without going through the auth middleware chain (e.g. the in-process MCP HTTP-handler dispatcher in internal/mcp/dispatch_http.go, which resolves OAuth users via the MCP middleware and then calls the API handle

(ctx context.Context, user *models.User)

Source from the content-addressed store, hash-verified

33//
34// Pass nil to clear (rare; mostly useful in tests).
35func WithCurrentUser(ctx context.Context, user *models.User) context.Context {
36 return context.WithValue(ctx, ctxCurrentUser, user)
37}
38
39// WithAPITokenAuth marks ctx as authenticated via an API token, the
40// same way TokenAuth does on the Bearer-token path. Required when

Calls

no outgoing calls