diff options
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/ui/auth/user.py')
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/auth/user.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/user.py b/utils/test/testapi/opnfv_testapi/ui/auth/user.py new file mode 100644 index 000000000..140bca51c --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/ui/auth/user.py @@ -0,0 +1,24 @@ +from tornado import gen +from tornado import web + +from opnfv_testapi.common import raises +from opnfv_testapi.ui.auth import base + + +class ProfileHandler(base.BaseHandler): + @web.asynchronous + @gen.coroutine + def get(self): + openid = self.get_secure_cookie('openid') + if openid: + try: + user = yield self.db_find_one({'openid': openid}) + self.finish_request({ + "openid": user.get('openid'), + "email": user.get('email'), + "fullname": user.get('fullname'), + "is_admin": False + }) + except Exception: + pass + raises.Unauthorized('Unauthorized') |