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)
def SignedHeaderAuth(app, app_conf): app = _SignedHeaderAuth(app, app_conf) secret = get_secret(app_conf) return HeaderSignatureCheckingMiddleware(app, secret)