decorators.py 文件源码

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

项目:auction-backend 作者: luissalgadofreire 项目源码 文件源码
def authenticate(token):
    """
    Tries to authenticate user based on the supplied token. It also checks
    the token structure and validity.

    Based on jwt_auth.JSONWebTokenAuthMixin.authenticate
    """
    try:
        payload = jwt_decode_handler(token)
    except jwt.ExpiredSignature:
        msg = 'Signature has expired.'
        raise exceptions.AuthenticationFailed(msg)
    except jwt.DecodeError:
        msg = 'Error decoding signature.'
        raise exceptions.AuthenticationFailed(msg)

    user = authenticate_credentials(payload)

    return user
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号