utilities.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Casper-HC 作者: jamfit 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号