Python itsdangerous.TimestampSigner() Examples
The following are 8
code examples of itsdangerous.TimestampSigner().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
itsdangerous
, or try the search function
.
Example #1
Source File: user_management.py From fame with GNU General Public License v3.0 | 5 votes |
def password_reset_token(user): signer = TimestampSigner(fame_config.secret_key) return signer.sign(str(user['_id']))
Example #2
Source File: user_management.py From fame with GNU General Public License v3.0 | 5 votes |
def validate_password_reset_token(token): signer = TimestampSigner(fame_config.secret_key) return signer.unsign(token, max_age=86400)
Example #3
Source File: user_management.py From fame with GNU General Public License v3.0 | 5 votes |
def password_reset_token(user): signer = TimestampSigner(fame_config.secret_key) return signer.sign(str(user['_id']))
Example #4
Source File: user_management.py From fame with GNU General Public License v3.0 | 5 votes |
def validate_password_reset_token(token): signer = TimestampSigner(fame_config.secret_key) return signer.unsign(token, max_age=86400).decode()
Example #5
Source File: tests_integration.py From channelstream with BSD 3-Clause "New" or "Revised" License | 5 votes |
def gen_signature(secret): from itsdangerous import TimestampSigner signer = TimestampSigner(secret) return signer.sign("channelstream")
Example #6
Source File: tokens.py From walle-web with Apache License 2.0 | 5 votes |
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)
Example #7
Source File: cookies.py From runbook with Apache License 2.0 | 5 votes |
def genCdata(uid, secretkey): s = TimestampSigner(secretkey) cookie = s.sign(uid) return cookie
Example #8
Source File: cookies.py From runbook with Apache License 2.0 | 5 votes |
def verifyCdata(cdata, secretkey, mxtime): s = TimestampSigner(secretkey) try: string = s.unsign(cdata, max_age=mxtime) return string except: return False