Fix JWT StatusOK test

Signed-off-by: Chris Goller <goller@gmail.com>
pull/256/head
Jade McGough 2016-10-13 17:15:35 -05:00 committed by Chris Goller
parent ecd64564fb
commit 34da2c2b95
1 changed files with 3 additions and 3 deletions

View File

@ -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)
})