Added stricter check for edge-case when token is nil

This commit is contained in:
Hafiz Ismail 2016-02-03 19:59:37 +08:00
parent 293f48cc84
commit fde476f0a7

View file

@ -117,7 +117,7 @@ func (ja *JwtAuth) Verify(paramAliases ...string) func(chi.Handler) chi.Handler
return
}
if !token.Valid || token.Method != ja.signer {
if token == nil || !token.Valid || token.Method != ja.signer {
err = ErrUnauthorized
ctx = ja.SetContext(ctx, token, err)
next.ServeHTTPC(ctx, w, r)