Skip to content

Instantly share code, notes, and snippets.

@cyantarek
Created February 6, 2019 12:27
Show Gist options
  • Save cyantarek/9174cf3861bf92efe18bb217645d2b95 to your computer and use it in GitHub Desktop.
Save cyantarek/9174cf3861bf92efe18bb217645d2b95 to your computer and use it in GitHub Desktop.
func validateToken(f http.HandlerFunc, srv *server.Server) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, err := srv.ValidationBearerToken(r)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
f.ServeHTTP(w, r)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment