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
I'm not sure I understand your question and I don't think it is related to this project.
Let's consider that a middleware is a function which takes an http.HandlerFunc (and maybe some other parameters) and returns an other http.HandlerFunc. The HTTPMiddleware function from this project fits this description.
m is a middleware that combines two middlewares. One to recover from a possible panic, and the other one to inject the dependency injection container in the request. If you have an authentication middleware, you can add it here.
For example you can create ma to add the authentication middleware to m:
and then you can decide to apply m or ma depending on the route:
r.HandleFunc("/cars", m(handlers.GetCarListHandler)).Methods("GET") // without authenticationr.HandleFunc("/cars", ma(handlers.PostCarHandler)).Methods("POST") // with authentication
Do you have an example on how to implement a authentication middleware that only authenticates part of the endpoints and not all of them?
Thanks in advance.
//Tagnard
The text was updated successfully, but these errors were encountered: