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)
| 120 | // For invalid key, it sends "401 - Unauthorized" response. |
| 121 | // For missing key, it sends "400 - Bad Request" response. |
| 122 | func 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 | // |
searching dependent graphs…