File: session.py

package info (click to toggle)
freeipa 4.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 367,240 kB
  • sloc: javascript: 562,763; python: 310,289; ansic: 49,809; sh: 7,176; makefile: 2,589; xml: 343; sed: 16
file content (36 lines) | stat: -rw-r--r-- 845 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#
# Copyright (C) 2015  FreeIPA Contributors see COPYING for license
#

import logging

from ipalib import Command
from ipalib.request import context
from ipalib.plugable import Registry
from ipalib.text import _

__doc__ = _("""
Session Support for IPA
""")

logger = logging.getLogger(__name__)

register = Registry()


@register()
class session_logout(Command):
    __doc__ = _('RPC command used to log the current user out of their'
                ' session.')
    NO_CLI = True

    def execute(self, *args, **options):
        ccache_name = getattr(context, 'ccache_name', None)
        if ccache_name is None:
            logger.debug('session logout command: no ccache_name found')
        else:
            delattr(context, 'ccache_name')

        setattr(context, 'logout_cookie', 'MagBearerToken=')

        return dict(result=None)