You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for the generated ServerInterfaceWrapper below, the middleware is executed before the below function is executed. Which is correct. I want to check the set APIKeyAuthScopes, but since the context is set after the middleware is called, I cannot do so.
func (w*ServerInterfaceWrapper) ValidateAPIKey(ctx echo.Context) error {
varerrerrorctx.Set(APIKeyAuthScopes, []string{"auth"})
// Invoke the callback with all the unmarshalled argumentserr=w.Handler.ValidateAPIKey(ctx)
returnerr
}
// web server based on echoe:=echo.New()
e.Use(middleware.CORS())
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.Use(auth.Middleware)
e.Validator=&shared.EchoValidator{Validator: shared.Validator}
auth.RegisterHandlers(e, &auth.ServerHandler{})
changed the title [-]Middleware is called before the generated ServerInterfaceWrapper function for echo[/-][+]Echo: Custom Authentication Middleware help.[/+]on Dec 30, 2022
This is expected behavior — Echo global middleware runs before route handlers. Use OapiRequestValidator middleware or implement auth in the handler itself.
Activity
[-]Middleware is called before the generated ServerInterfaceWrapper function for echo[/-][+]Echo: Custom Authentication Middleware help.[/+]debuggerpk commentedon Dec 30, 2022
possible duplicate of #114
mromaszewicz commentedon Feb 7, 2026
This is expected behavior — Echo global middleware runs before route handlers. Use OapiRequestValidator middleware or implement auth in the handler itself.