this repo has no description
1package routes 2 3import ( 4 "net/http" 5) 6 7func (h *Handle) AuthMiddleware(next http.Handler) http.Handler { 8 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 9 session, _ := h.s.Get(r, "bild-session") 10 auth, ok := session.Values["authenticated"].(bool) 11 if !ok || !auth { 12 http.Error(w, "Forbidden: You are not logged in", http.StatusForbidden) 13 return 14 } 15 next.ServeHTTP(w, r) 16 }) 17}