tokens.py 文件源码

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

项目:flask-jwt-extended 作者: vimalloc 项目源码 文件源码
def encode_refresh_token(identity, secret, algorithm, expires_delta, csrf,
                         identity_claim_key):
    """
    Creates a new encoded (utf-8) refresh token.

    :param identity: Some identifier used to identify the owner of this token
    :param secret: Secret key to encode the JWT with
    :param algorithm: Which algorithm to use for the toek
    :param expires_delta: How far in the future this token should expire
                          (set to False to disable expiration)
    :type expires_delta: datetime.timedelta or False
    :param csrf: Whether to include a csrf double submit claim in this token
                 (boolean)
    :param identity_claim_key: Which key should be used to store the identity
    :return: Encoded refresh token
    """
    token_data = {
        identity_claim_key: identity,
        'type': 'refresh',
    }
    if csrf:
        token_data['csrf'] = _create_csrf_token()
    return _encode_jwt(token_data, expires_delta, secret, algorithm)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号