[PATCH phosphor-rest-server] Add a convenient/short logout command

OpenBMC Patches openbmc-patches at stwcx.xyz
Fri Jun 17 22:00:46 AEST 2016


From: Nan Li <bjlinan at cn.ibm.com>

With this patch, we can logout by:
    curl -c cjar -b cjar -k https://BMC/logout
Traditional/json format logout is retained.

Signed-off-by: Nan Li <bjlinan at cn.ibm.com>
---
 obmc-rest | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/obmc-rest b/obmc-rest
index e7dbbba..8750a1f 100644
--- a/obmc-rest
+++ b/obmc-rest
@@ -411,6 +411,7 @@ class SessionHandler(MethodHandler):
     ''' Handles the /login and /logout routes, manages
     server side session store and session cookies.  '''
 
+    verbs = ['POST', 'GET']
     rules = ['/login', '/logout']
     login_str = "User '%s' logged %s"
     bad_passwd_str = "Invalid username or password"
@@ -460,6 +461,10 @@ class SessionHandler(MethodHandler):
             request.get_cookie(
                 'sid', secret=self.hmac_key))
 
+    def do_get(self, **kw):
+        if request.path == '/logout':
+            return self.do_logout(**kw)
+
     def do_post(self, **kw):
         if request.path == '/login':
             return self.do_login(**kw)
-- 
2.8.4




More information about the openbmc mailing list