package middleware import ( "RenewCMS/api/pkg/apperr" "RenewCMS/api/pkg/authtoken" "net/http" ) func RequireSignedIn(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if _, err := authtoken.FromContext(r.Context()); err != nil { http.Error(w, apperr.UnauthorizedErrorMessage, http.StatusUnauthorized) return } next.ServeHTTP(w, r) }) }