Legrand / Raritan Xerus™ JSON-RPC API for Remote Access Devices like KX4-101, KX3G2
Loading...
Searching...
No Matches
SessionManager.idl
1/* SPDX-License-Identifier: BSD-3-Clause */
2/*
3 * Copyright 2009 Raritan Inc. All rights reserved.
4 */
5
6/**
7 * %Session Management
8 */
9
10#include <Event.idl>
11
12module session {
13
14 /** %Session information */
15 structure Session {
16 int sessionId; ///< ID of the session
17 string username; ///< Name of user owning the session
18 string remoteIp; ///< Session IP address
19 string clientType; ///< Client type
20 time creationTime; ///< Session creation timestamp (seconds since system boot)
21 int timeout; ///< Session timeout in seconds
22 int idle; ///< Session idle time in seconds
23 int userIdle; ///< User idle time in seconds
24 };
25
26 /** %Session history entry */
27 structure HistoryEntry {
28 time creationTime; ///< Session creation timestamp (UNIX timestamp, UTC)
29 string remoteIp; ///< Session IP address
30 string clientType; ///< Session client type
31 };
32
33 /**
34 * %Session manager interface
35 *
36 * Session manager allows clients to announce a user session,
37 * i.e. consecutive activity that is related to each other,
38 * and make use of session services.
39 * Depending on transport protocol an established session
40 * allows simplified authentication using the session token.
41 * For instance, for HTTP transport implementation session token
42 * can be written into HTTP Header while other authentication
43 * schemes may be omitted (for details, see transport mapping
44 * documentation).
45 *
46 * Each session has a defined timeout and an idle timer.
47 * A session is deleted once idle time is equal or greater
48 * than session timeout. Idle timer is implicitly touched
49 * by transport implementation whenever a call arrives that
50 * can be mapped to a particular session. In addition, a client
51 * may decide to call touchCurrentSession with userActivity flag
52 * set to true. In this case userIdle attribute of session is reset
53 * to 0. This has purely informational character and will not cause
54 * any further action of session manager. It may be used to determine
55 * user activity under the assumptions that clients may do frequent
56 * background calls without actual user activity.
57 */
58 interface SessionManager {
59
60 constant int ERR_ACTIVE_SESSION_EXCLUSIVE_FOR_USER = 1; ///< Session creation denied due to single login limitation
61 constant int ERR_NO_SUCH_SESSION = 2; ///< Session for provided data could not be found
62
63 /** %Session close reasons */
64 enumeration CloseReason {
65 CLOSE_REASON_LOGOUT, ///< Regular logout
66 CLOSE_REASON_TIMEOUT, ///< Session timed out
67 CLOSE_REASON_BROWSER_CLOSED, ///< Browser window was closed
68 CLOSE_REASON_FORCED_DISCONNECT ///< Session was forcibly closed
69 };
70
71 /**
72 * Open a new session.
73 *
74 * This function will create a new session for the authenticated user.
75 * Upon success it will return a session token which can be used to
76 * authenticate future requests.
77 *
78 * @param session %Session information
79 * @param token Returned token for the newly created session
80 *
81 * @return 0 if OK
82 * @return 1 if session creation was denied due to single login limitation
83 */
84 int newSession(out Session session, out string token);
85
86 /**
87 * Retrieve an existing session using CC-SG provided session data
88 *
89 * @param sessionId Session ID
90 * @param sessionKey Session key
91 * @param session %Session information
92 * @param token Returned session token
93 *
94 * @return 0 if OK
95 * @return 1 if session creation was denied due to single login limitation
96 */
97 int getSessionForCcSessionData(in string sessionId, in string sessionKey, out Session session, out string token);
98
99 /**
100 * Retrieve current session information.
101 *
102 * This call must be authenticated using a session token.
103 *
104 * @return %Session information
105 */
107
108 /**
109 * Retrieve all open sessions.
110 *
111 * @return List of sessions
112 */
113 vector<Session> getSessions();
114
115 /**
116 * Close a session identified by its token.
117 *
118 * @param sessionId ID of the session that should be closed
119 * @param reason close reason
120 */
121 void closeSession(in int sessionId, in CloseReason reason);
122
123 /**
124 * Close the current session.
125 *
126 * This call must be authenticated using a session token.
127 *
128 * @param reason close reason
129 */
131
132 /**
133 * Reset the current session's idle timer.
134 *
135 * @param userActivity Indicates that the session is touched
136 * due to user activity.
137 *
138 * If userActivity is not set, this is internally a NOP since
139 * any RPC call will implicitly touch the session.
140 * This call must be authenticated using a session token.
141 */
142 void touchCurrentSession(in boolean userActivity);
143
144 /**
145 * Get previous session data for the current user
146 *
147 * @return History data, sorted from newer to older sessions
148 */
149 vector<HistoryEntry> getSessionHistory();
150
151 /** Event: Session was created */
152 valueobject SessionCreatedEvent extends idl.Event {
153 int sessionId; ///< ID of the session
154 string username; ///< Name of user owning the session
155 string remoteIp; ///< Session IP address
156 };
157
158 /** Event: Session was closed */
159 valueobject SessionClosedEvent extends idl.Event {
160 int sessionId; ///< ID of the session
161 string username; ///< Name of user owning the session
162 string remoteIp; ///< Session IP address
163 CloseReason reason; ///< close reason
164 };
165 };
166}
Session manager interface
void closeSession(in int sessionId, in CloseReason reason)
Close a session identified by its token.
vector< HistoryEntry > getSessionHistory()
Get previous session data for the current user.
constant int ERR_NO_SUCH_SESSION
Session for provided data could not be found.
void closeCurrentSession(in CloseReason reason)
Close the current session.
vector< Session > getSessions()
Retrieve all open sessions.
int getSessionForCcSessionData(in string sessionId, in string sessionKey, out Session session, out string token)
Retrieve an existing session using CC-SG provided session data.
constant int ERR_ACTIVE_SESSION_EXCLUSIVE_FOR_USER
Session creation denied due to single login limitation.
Session getCurrentSession()
Retrieve current session information.
int newSession(out Session session, out string token)
Open a new session.
void touchCurrentSession(in boolean userActivity)
Reset the current session's idle timer.
CloseReason
Session close reasons
@ CLOSE_REASON_FORCED_DISCONNECT
Session was forcibly closed.
@ CLOSE_REASON_BROWSER_CLOSED
Browser window was closed.
@ CLOSE_REASON_TIMEOUT
Session timed out.
@ CLOSE_REASON_LOGOUT
Regular logout.
Basic IDL definitions.
Definition Event.idl:10
Session Management
Common base for all events.
Definition Event.idl:13
Session history entry
time creationTime
Session creation timestamp (UNIX timestamp, UTC)
string remoteIp
Session IP address.
string clientType
Session client type.
string username
Name of user owning the session.
string username
Name of user owning the session.
Session information
string username
Name of user owning the session.
int userIdle
User idle time in seconds.
string clientType
Client type.
int timeout
Session timeout in seconds.
time creationTime
Session creation timestamp (seconds since system boot)
string remoteIp
Session IP address.
int sessionId
ID of the session.
int idle
Session idle time in seconds.