summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/auth/sign.py
blob: 01cd0f7c35ed6fa6b3fd112225e3c1743ddd0547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from cas import CASClient

from opnfv_testapi.common import constants
from opnfv_testapi.common.config import CONF
from opnfv_testapi.resources import handlers


class SigninHandler(handlers.GenericApiHandler):
    def get(self):
        client = CASClient(version='2',
                           server_url=CONF.lfid_cas_url,
                           service_url=CONF.ui_url)
        self.redirect(url=(client.get_login_url()))


class SignoutHandler(handlers.GenericApiHandler):
    def get(self):
        """Handle signout request."""
        self.clear_cookie(constants.TESTAPI_ID)
        client = CASClient(version='2',
                           server_url=CONF.lfid_cas_url)
        self.redirect(url=(client.get_logout_url(redirect_url=CONF.ui_url)))