From 5e2e95719f26f54db9ecf28847c36098b253b290 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam Date: Fri, 25 Sep 2020 16:00:39 +0530 Subject: Added Mem-cache for storing token Issue-ID: DOVETAIL-801 Signed-off-by: Kanagaraj Manickam Change-Id: Ia3a3683a6e635c86447ca6bd96c7416d73febf7d --- opnfv_testapi/ui/auth/sign.py | 7 +++++-- requirements.txt | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/opnfv_testapi/ui/auth/sign.py b/opnfv_testapi/ui/auth/sign.py index 9652364..0667227 100644 --- a/opnfv_testapi/ui/auth/sign.py +++ b/opnfv_testapi/ui/auth/sign.py @@ -27,6 +27,7 @@ import logging import oauth2 as oauth import requests import json +import memcache root = logging.getLogger() root.setLevel(logging.DEBUG) @@ -316,6 +317,8 @@ class LoginHandler(base.BaseHandler): raises.Unauthorized(message.invalid_credentials()) # generate random token token = base.get_token() - self.set_secure_cookie("token", token) resp = {'status': 'success'} - self.finish_request(resp) + mc = memcache.Client(['127.0.0.1:11211'], debug=0) + mc.set("token", token) + self.set_header("token", token) + self.finish_request(response) diff --git a/requirements.txt b/requirements.txt index e924f0b..7c7ee2f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,3 +26,4 @@ python-cas==1.2.0 futures==3.2.0 python-slugify==2.0.1 Pillow==3.1.2 +python-memcached==1.59 -- cgit 1.2.3-korg