コード例 #1
0
def make_cookie(username):
    from pylons import config
    secret = get_secret(config['app_conf'])
    auth = hmac.new(secret, username, sha).hexdigest()
    cookie = quote(("%s\0%s" % (username, auth)).encode("base64")).strip()
    return ('__ac', cookie)
コード例 #2
0
def SignedHeaderAuth(app, app_conf):
    app = _SignedHeaderAuth(app, app_conf)
    secret = get_secret(app_conf)
    return HeaderSignatureCheckingMiddleware(app, secret)