MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / Auth

Function Auth

server-source-code/internal/middleware/auth.go:23–25  ·  view source on GitHub ↗

Auth returns a middleware that validates JWT and sets user context. When sessionsStore and resolved are provided and sessionID is in the token, validates session inactivity timeout and updates last_activity.

(cfg *config.Config, log *slog.Logger)

Source from the content-addressed store, hash-verified

21// When sessionsStore and resolved are provided and sessionID is in the token,
22// validates session inactivity timeout and updates last_activity.
23func Auth(cfg *config.Config, log *slog.Logger) func(http.Handler) http.Handler {
24 return AuthWithSessionCheck(cfg, nil, nil, log)
25}
26
27// AuthWithSessionCheck returns Auth middleware with session inactivity validation.
28func AuthWithSessionCheck(cfg *config.Config, sessionsStore *store.SessionsStore, resolved *config.ResolvedConfig, log *slog.Logger) func(http.Handler) http.Handler {

Callers

nothing calls this directly

Calls 1

AuthWithSessionCheckFunction · 0.85

Tested by

no test coverage detected