2015-07-08 03:32:54 -05:00
|
|
|
#
|
|
|
|
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
|
|
|
|
#
|
|
|
|
|
2017-05-23 11:35:57 -05:00
|
|
|
import logging
|
|
|
|
|
2016-06-29 08:53:52 -05:00
|
|
|
from ipalib import Command
|
2015-07-08 03:32:54 -05:00
|
|
|
from ipalib.request import context
|
|
|
|
from ipalib.plugable import Registry
|
2018-06-04 05:19:42 -05:00
|
|
|
from ipalib.text import _
|
2015-07-16 03:17:26 -05:00
|
|
|
|
2018-06-20 05:29:27 -05:00
|
|
|
__doc__ = _("""
|
|
|
|
Session Support for IPA
|
|
|
|
""")
|
|
|
|
|
2017-05-23 11:35:57 -05:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2015-07-08 03:32:54 -05:00
|
|
|
register = Registry()
|
|
|
|
|
|
|
|
|
|
|
|
@register()
|
|
|
|
class session_logout(Command):
|
2018-06-04 05:19:42 -05:00
|
|
|
__doc__ = _('RPC command used to log the current user out of their'
|
|
|
|
' session.')
|
2015-07-08 03:32:54 -05:00
|
|
|
NO_CLI = True
|
|
|
|
|
|
|
|
def execute(self, *args, **options):
|
2016-08-19 08:23:55 -05:00
|
|
|
ccache_name = getattr(context, 'ccache_name', None)
|
|
|
|
if ccache_name is None:
|
2017-05-23 11:35:57 -05:00
|
|
|
logger.debug('session logout command: no ccache_name found')
|
2017-02-16 10:07:31 -06:00
|
|
|
else:
|
|
|
|
delattr(context, 'ccache_name')
|
2015-07-08 03:32:54 -05:00
|
|
|
|
2017-02-20 11:38:11 -06:00
|
|
|
setattr(context, 'logout_cookie', 'MagBearerToken=')
|
2015-07-08 03:32:54 -05:00
|
|
|
|
|
|
|
return dict(result=None)
|