Support Center
Returns details of a user session from target_ust, provided that the session exists, has not expired, and that its user's password has not expired. Only super-users are allowed to invoke this API.
get(self, cid, target_ust, current_ust, current_app, remote_addr, user_agent=None)
cid
: Correlation ID used by audit logtarget_ust
: UST of the session to return details ofcurrent_ust
: Current user's UST (must belong to a super-user)current_app
: Name of application the current user is issuing the call fromremote_addr
: Current user's remote addressuser_agent
: User agent stringReturns
: A dictionary of metadata describing the session from target_ust. All keys and values are always returned on output.Each dictionary returned is in the format described below:
Key | Datatype | Notes |
---|---|---|
creation_time | datetime | When the session was created, in UTC |
expiration_time | datetime | When the session will expire, in UTC |
remote_addr | string | From what remote address the session was created |
user_agent | string | Using what user agent the session was created |
# -*- coding: utf-8 -*-
# Zato
from zato.server.service import Service
class GetSession(Service):
def handle(self):
username = 'admin1'
password = 'abxqDJpXMVXYEO8NOGx9nVZvv4xSew9-'
current_app = 'CRM'
remote_addr = '127.0.0.1'
user_agent = 'Firefox 139.0'
# Log current user
session = self.sso.user.login(username, password, current_app, remote_addr, user_agent)
# Get UST
ust = session.ust
# Get current user's session
session = self.sso.user.session.get(self.cid, ust, ust, current_app, remote_addr)
# Log result
for key, value in sorted(session.to_dict().items()):
self.logger.info('%s %s', key.ljust(15), value)