summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerena Feng <feng.xiaowei@zte.com.cn>2017-05-20 07:30:09 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-05-20 07:30:09 +0000
commit2429648fb065bf9b27f7cb2555232a14db74eb29 (patch)
tree198e4eacf4dc4f2bc3607fab4e0a64763a2aef2b
parent4eb3f92c41b9d586ea388ff49197c3b536fb9465 (diff)
parentd8873d3488e7ddf33d05ef25fb0c4cdbe6563c22 (diff)
Merge "add signout funcationality"
-rw-r--r--utils/test/testapi/opnfv_testapi/router/url_mappings.py1
-rw-r--r--utils/test/testapi/opnfv_testapi/ui/auth/constants.py2
-rw-r--r--utils/test/testapi/opnfv_testapi/ui/auth/sign.py12
3 files changed, 15 insertions, 0 deletions
diff --git a/utils/test/testapi/opnfv_testapi/router/url_mappings.py b/utils/test/testapi/opnfv_testapi/router/url_mappings.py
index d68670185..aea85a4c4 100644
--- a/utils/test/testapi/opnfv_testapi/router/url_mappings.py
+++ b/utils/test/testapi/opnfv_testapi/router/url_mappings.py
@@ -62,5 +62,6 @@ mappings = [
(r'/', root.RootHandler),
(r'/api/v1/auth/signin', sign.SigninHandler),
(r'/api/v1/auth/signin_return', sign.SigninReturnHandler),
+ (r'/api/v1/auth/signout', sign.SignoutHandler),
(r'/api/v1/profile', user.ProfileHandler),
]
diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/constants.py b/utils/test/testapi/opnfv_testapi/ui/auth/constants.py
index ec5975171..43f69d7f5 100644
--- a/utils/test/testapi/opnfv_testapi/ui/auth/constants.py
+++ b/utils/test/testapi/opnfv_testapi/ui/auth/constants.py
@@ -1,3 +1,5 @@
+OPENID = 'openid'
+
# OpenID parameters
OPENID_MODE = 'openid.mode'
OPENID_NS = 'openid.ns'
diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/sign.py b/utils/test/testapi/opnfv_testapi/ui/auth/sign.py
index c92196a7a..73190841f 100644
--- a/utils/test/testapi/opnfv_testapi/ui/auth/sign.py
+++ b/utils/test/testapi/opnfv_testapi/ui/auth/sign.py
@@ -43,3 +43,15 @@ class SigninReturnHandler(base.BaseHandler):
if not self.get_secure_cookie('openid'):
self.set_secure_cookie('openid', openid)
self.redirect(url=CONF.ui_url)
+
+
+class SignoutHandler(base.BaseHandler):
+ def get(self):
+ """Handle signout request."""
+ openid = self.get_secure_cookie(const.OPENID)
+ if openid:
+ self.clear_cookie(const.OPENID)
+ params = {'openid_logout': CONF.osid_openid_logout_endpoint}
+ url = parse.urljoin(CONF.ui_url,
+ '/#/logout?' + parse.urlencode(params))
+ self.redirect(url)