Chat now with support
Chat with Support

One Identity Safeguard for Privileged Sessions 6.2.0 - Creating custom Credential Store plugins

session_ended

A session is the logical unit of user connections: it starts with logging in to the target, and ends when the connection ends. SPS executes the session_id hook when the session is closed. It is called exactly once for the same session.

TIP:

You can use this hook to send a log message related to the entire session or close the ticket related to the session if the plugin interacts with a ticketing system.

You must implement the session_ended method in the plugin.

Input arguments

  • session_id

    Type: string

    Description: The unique identifier of the session.

  • cookie

    Type: dictionary

    Description: The cookie returned by the previous hook in the session. If this is the first call for that session, it is initialized as an empty dictionary, otherwise it has the value returned by one of the previous calls in this particular custom Credential Store plugin. You can use the cookie to maintain the state for each particular connection or to transfer information between the different methods of the plugin. For an example that transfers information in the cookie between two methods, see "Examples" in the Creating custom Authentication and Authorization plugins.

  • session_cookie

    Type: dictionary

    Description: You can use the session cookie to maintain global state between plugins for each particular connection. If this is the first call for that session, it is initialized as an empty dictionary, otherwise it has the value returned by a previous plugin hook in the session.

Returned values

This hook does not return values.

session_ended example

The following example formats every information received in the cookie into key-value pairs and prints a log message that includes this information.

Key-value pairs in log message
def session_ended(self, session_id, session_cookie, cookie):
    session_details = ','.join([
        '{0}={1}'.format(key, cookie[key])
        for key in sorted(cookie.keys())
    ])
    print("Session ended; session_id='{0}', session_details='{1}'".
        format(session_id, session_details))
Related Documents