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

Function WithCurrentUser

internal/server/context.go:25–27  ·  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

23//
24// Pass nil to clear (rare; mostly useful in tests).
25func WithCurrentUser(ctx context.Context, user *models.User) context.Context {
26 return context.WithValue(ctx, ctxCurrentUser, user)
27}
28
29// WithAPITokenAuth marks ctx as authenticated via an API token, the
30// same way TokenAuth does on the Bearer-token path. Required when

Calls

no outgoing calls