From 34da2c2b955e8ecb5a0be6c84cc6d30875bb6006 Mon Sep 17 00:00:00 2001 From: Jade McGough Date: Thu, 13 Oct 2016 17:15:35 -0500 Subject: [PATCH] Fix JWT StatusOK test Signed-off-by: Chris Goller --- handlers/jwt.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handlers/jwt.go b/handlers/jwt.go index a6cb41e6f..4a761c3b4 100644 --- a/handlers/jwt.go +++ b/handlers/jwt.go @@ -52,7 +52,7 @@ func AuthorizedToken(opts JWTOpts, next http.Handler) http.Handler { // 3. Check if time is after not before (nbf) token, err := jwt.ParseWithClaims(jwtToken, &jwt.StandardClaims{}, keyLookupFn) if err != nil { - w.WriteHeader(http.StatusOK) + w.WriteHeader(http.StatusUnauthorized) return } else if !token.Valid { w.WriteHeader(http.StatusUnauthorized) @@ -69,9 +69,9 @@ func AuthorizedToken(opts JWTOpts, next http.Handler) http.Handler { return } // TODO: check if the sub (e.g. /users/1) really exists + next.ServeHTTP(w, r) + return } - next.ServeHTTP(w, r) - return } w.WriteHeader(http.StatusUnauthorized) })