def verify_jwt(signed_token):
unvalidated_token = jwt.decode(signed_token, verify=False)
hipchat_room = HipChatRoom.query.filter(HipChatRoom.hipchat_oauth_id == unvalidated_token['iss']).first_or_404()
try:
jwt.decode(signed_token, hipchat_room.hipchat_oauth_secret)
except jwt.exceptions.DecodeError:
flask.flash('Unable to decode the Java Web Token provided', 'error')
flask.abort(401)
except jwt.ExpiredSignatureError:
flask.flash('The provided Java Web Token is expired: try refreshing the page', 'error')
flask.abort(401)
else:
return hipchat_room
评论列表
文章目录