當前位置: 首頁>>代碼示例>>Python>>正文


Python itsdangerous.TimestampSigner方法代碼示例

本文整理匯總了Python中itsdangerous.TimestampSigner方法的典型用法代碼示例。如果您正苦於以下問題:Python itsdangerous.TimestampSigner方法的具體用法?Python itsdangerous.TimestampSigner怎麽用?Python itsdangerous.TimestampSigner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在itsdangerous的用法示例。


在下文中一共展示了itsdangerous.TimestampSigner方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: password_reset_token

# 需要導入模塊: import itsdangerous [as 別名]
# 或者: from itsdangerous import TimestampSigner [as 別名]
def password_reset_token(user):
    signer = TimestampSigner(fame_config.secret_key)

    return signer.sign(str(user['_id'])) 
開發者ID:certsocietegenerale,項目名稱:fame,代碼行數:6,代碼來源:user_management.py

示例2: validate_password_reset_token

# 需要導入模塊: import itsdangerous [as 別名]
# 或者: from itsdangerous import TimestampSigner [as 別名]
def validate_password_reset_token(token):
    signer = TimestampSigner(fame_config.secret_key)

    return signer.unsign(token, max_age=86400) 
開發者ID:certsocietegenerale,項目名稱:fame,代碼行數:6,代碼來源:user_management.py

示例3: validate_password_reset_token

# 需要導入模塊: import itsdangerous [as 別名]
# 或者: from itsdangerous import TimestampSigner [as 別名]
def validate_password_reset_token(token):
    signer = TimestampSigner(fame_config.secret_key)

    return signer.unsign(token, max_age=86400).decode() 
開發者ID:certsocietegenerale,項目名稱:fame,代碼行數:6,代碼來源:user_management.py

示例4: gen_signature

# 需要導入模塊: import itsdangerous [as 別名]
# 或者: from itsdangerous import TimestampSigner [as 別名]
def gen_signature(secret):
    from itsdangerous import TimestampSigner

    signer = TimestampSigner(secret)
    return signer.sign("channelstream") 
開發者ID:Channelstream,項目名稱:channelstream,代碼行數:7,代碼來源:tests_integration.py

示例5: __init__

# 需要導入模塊: import itsdangerous [as 別名]
# 或者: from itsdangerous import TimestampSigner [as 別名]
def __init__(self):
        """ Create a cypher to encrypt IDs and a signer to sign tokens."""
        # Create cypher to encrypt IDs
        # and ensure >=16 characters
        # secret = app.config.get('SECRET_KEY')
        secret = 'SECRET_KEY'
        precursor = b'0123456789abcdef'
        if isinstance(secret, bytes):
            key = secret + precursor
        else:
            key = secret.encode("utf-8") + precursor
        self.cipher = AES.new(key[0:16], AES.MODE_CBC)

        # Create signer to sign tokens
        self.signer = TimestampSigner(secret) 
開發者ID:meolu,項目名稱:walle-web,代碼行數:17,代碼來源:tokens.py

示例6: genCdata

# 需要導入模塊: import itsdangerous [as 別名]
# 或者: from itsdangerous import TimestampSigner [as 別名]
def genCdata(uid, secretkey):
    s = TimestampSigner(secretkey)
    cookie = s.sign(uid)
    return cookie 
開發者ID:Runbook,項目名稱:runbook,代碼行數:6,代碼來源:cookies.py

示例7: verifyCdata

# 需要導入模塊: import itsdangerous [as 別名]
# 或者: from itsdangerous import TimestampSigner [as 別名]
def verifyCdata(cdata, secretkey, mxtime):
    s = TimestampSigner(secretkey)
    try:
        string = s.unsign(cdata, max_age=mxtime)
        return string
    except:
        return False 
開發者ID:Runbook,項目名稱:runbook,代碼行數:9,代碼來源:cookies.py


注:本文中的itsdangerous.TimestampSigner方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。