示例#1
0
def validate_token(token):
    signer = TimestampSigner(settings.SECRET_KEY)
    decoded_string = base64.b64decode(token)
    try:
        output = signer.unsign(decoded_string, settings.TOKEN_SIGNING_TIMELIMIT)
    except BadSignature, e:
        return False
示例#2
0
def generate_signed_token(input):
    signer = TimestampSigner(settings.SECRET_KEY)
    signed_string = signer.sign(input)
    return base64.b64encode(signed_string)