generate HTTP error code also if jwt token parameter is missing in request

This commit is contained in:
Michele Comitini
2018-07-26 20:01:38 +02:00
parent 39dd86d6fb
commit 6f2be48e25

View File

@@ -1311,6 +1311,8 @@ class AuthJWT(object):
token = parts[1]
else:
token = current.request.vars.get(token_param)
if token is None:
raise HTTP(400, 'JWT header not found and JWT parameter {} missing in request'.format(token_param))
self.recvd_token = token
return token
@@ -1335,8 +1337,6 @@ class AuthJWT(object):
if required:
raise e
token = None
if not token and required:
raise HTTP(400, 'Invalid token')
if token and len(token) < self.max_header_length:
old_verify_expiration = self.verify_expiration
try: