MCPcopy Index your code
hub / github.com/labstack/echo / KeyAuth

Function KeyAuth

middleware/key_auth.go:122–126  ·  view source on GitHub ↗

KeyAuth returns an KeyAuth middleware. For valid key it calls the next handler. For invalid key, it sends "401 - Unauthorized" response. For missing key, it sends "400 - Bad Request" response.

(fn KeyAuthValidator)

Source from the content-addressed store, hash-verified

120// For invalid key, it sends "401 - Unauthorized" response.
121// For missing key, it sends "400 - Bad Request" response.
122func KeyAuth(fn KeyAuthValidator) echo.MiddlewareFunc {
123 c := DefaultKeyAuthConfig
124 c.Validator = fn
125 return KeyAuthWithConfig(c)
126}
127
128// KeyAuthWithConfig returns an KeyAuth middleware or panics if configuration is invalid.
129//

Callers 1

TestKeyAuthFunction · 0.85

Calls 1

KeyAuthWithConfigFunction · 0.85

Tested by 1

TestKeyAuthFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…