MCPcopy Create free account
hub / github.com/danielmiessler/Fabric / APIKeyMiddleware

Function APIKeyMiddleware

internal/server/auth.go:121–123  ·  view source on GitHub ↗

APIKeyMiddleware validates API key for protected endpoints. Swagger documentation endpoints (/swagger/*) are exempt from authentication to allow users to browse and test the API documentation freely.

(apiKey string)

Source from the content-addressed store, hash-verified

119// Swagger documentation endpoints (/swagger/*) are exempt from authentication
120// to allow users to browse and test the API documentation freely.
121func APIKeyMiddleware(apiKey string) gin.HandlerFunc {
122 return apiKeyMiddleware(apiKey, newAuthFailureLimiter())
123}
124
125func apiKeyMiddleware(apiKey string, limiter *authFailureLimiter) gin.HandlerFunc {
126 // Hash the configured key so the comparison avoids leaking its length through timing.

Callers 3

TestAPIKeyMiddlewareFunction · 0.85
newSecuredEngineFunction · 0.85
TestCORSMiddlewareFunction · 0.85

Calls 2

apiKeyMiddlewareFunction · 0.85
newAuthFailureLimiterFunction · 0.85

Tested by 2

TestAPIKeyMiddlewareFunction · 0.68
TestCORSMiddlewareFunction · 0.68