I want to use the value of key isAuthority in the adapter to make the authorization judgment . how can i do.
for example:
var routeList = routes{
{
pattern: "/article",
method: GET,
HandlerFunc: ctrls.GetAll,
isAuthority: false,
},
{
pattern: "/article/:id",
method: GET,
isAuthority: false,
},
router := mux.NewRouter().StrictSlash(true)
for _, item := range routeList {
router.Path(item.pattern).
Methods(item.method).
Handler(item.HandlerFunc).
???(item.isAuthority)
}
func adapter(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
//how to get the value of currentRoute'isAuthority
})
}