mirror of
https://github.com/labstack/echo.git
synced 2025-06-15 00:14:57 +02:00
Key auth validator now accepts context
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
@ -32,7 +32,7 @@ type (
|
||||
}
|
||||
|
||||
// KeyAuthValidator defines a function to validate KeyAuth credentials.
|
||||
KeyAuthValidator func(string) bool
|
||||
KeyAuthValidator func(string, echo.Context) bool
|
||||
|
||||
keyExtractor func(echo.Context) (string, error)
|
||||
)
|
||||
@ -94,7 +94,7 @@ func KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc {
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, err.Error())
|
||||
}
|
||||
if config.Validator(key) {
|
||||
if config.Validator(key, c) {
|
||||
return next(c)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user