All Classes Files Functions Variables Pages
Session.idl
Go to the documentation of this file.
1 /**
2  * @file Session.idl
3  * @brief Session for webadmin
4  * @version 2
5  */
6 
7 #import <kerio/web/idl/SharedStructures.idl>
8 
9 module webadmin {
10 
11 /**
12  * Describes client (third-party) application or script which uses the Administration API.
13  */
15  string name; ///< E.g. "Simple server monitor"
16  string vendor; ///< E.g. "MyScript Ltd."
17  string version; ///< E.g. "1.0.0 beta 1"
18 };
19 
20 enum LoginType {
21  LoginRegular,
22  LoginAutomatic,
23  LoginReactivation
24 };
25 
27  string name;
28  long timestamp;
29 };
30 
31 typedef sequence<ClientTimestamp> ClientTimestampList;
32 
33 /** May be created only if user is authenticated (request contains valid cookie) */
34 interface Session
35 {
36  /**
37  * Retrieves an unique session ID intended to be used for CSRF protection in web forms. \n
38  * This ID is different from the session cookie but also remains the same during the session lifetime.
39  *
40  * @throws kerio::web::ApiException \n
41  * -32001 Session expired. - "The user is not logged in." \n
42  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
43  */
44  void getCsrfToken(out string token);
45 
46  /**
47  * Retrieves name os logged user
48  *
49  * @throws kerio::web::ApiException \n
50  * -32001 Session expired. - "The user is not logged in." \n
51  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
52  */
53  void getUserName(out string name);
54 
55  /**
56  * Log in given user.
57  *
58  * Please note that with a session to one module you cannot use another one (eg. with admin session you cannot use webmail).
59  *
60  * @param token - CSRF attack prevention token, use it as X-Token HTTP header
61  * @param userName - login name + domain name (can be omitted if primary/local) of the user to be logged in, e.g. "jdoe" or "jdoe@company.com"
62  * @param password - password of the user to be logged in
63  * @param application - client application description
64  *
65  * @throws kerio::web::ApiException \n
66  * 1000 Operation failed. - "Username or password is not correct." \n
67  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
68  */
69  [KAuthentication(AuthenticationMode.NO_AUTHENTICATION_REQUIRED)]
70  [KLoginMethod]
71  void login(out string token, in string userName, in string password, in ApiApplication application);
72 
73  /**
74  * destroys session
75  *
76  * @throws kerio::web::ApiException \n
77  * -32001 Session expired. - "The user is not logged in." \n
78  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
79  */
80  [KLogoutMethod]
81  void logout();
82 
83  /**
84  * Returns clients defined variable stored in configuration for logged user
85  *
86  * @throws kerio::web::ApiException \n
87  * -32001 Session expired. - "The user is not logged in." \n
88  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
89  */
90  void getSessionVariable(in string name, out string value);
91 
92  /**
93  * Stores clients defined variable to configuration for logged user
94  *
95  * @throws kerio::web::ApiException \n
96  * -32001 Session expired. - "The user is not logged in." \n
97  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
98  */
99  void setSessionVariable(in string name, in string value);
100 
101  /**
102  * reset all persistent objects (managers) in session
103  *
104  * @throws kerio::web::ApiException \n
105  * -32001 Session expired. - "The user is not logged in." \n
106  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
107  */
108  void reset();
109 
110  /**
111  * Reloads configuration and returns timestamp of current configuration
112  * @param clientTimestampList - is empty in case, that cut-off prevention is not active
113  *
114  * @throws kerio::web::ApiException \n
115  * -32001 Session expired. - "The user is not logged in." \n
116  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
117  */
118  void getConfigTimestamp(out ClientTimestampList clientTimestampList);
119 
120  /**
121  * Confirm the new configuration
122  * @param confirmed - true in case, that cut-off prevention was active and timestamp matched last provided timestamp
123  * @param clientTimestampList - values obtained by getConfigTimestamp
124  *
125  * @throws kerio::web::ApiException \n
126  * -32001 Session expired. - "The user is not logged in." \n
127  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
128  */
129  void confirmConfig(out boolean confirmed, in ClientTimestampList clientTimestampList);
130 
131  /**
132  * Returns id of interface through which is client connected to server
133  * @param id - id of interface or empty in case of localhost
134  *
135  * @throws kerio::web::ApiException \n
136  * -32001 Session expired. - "The user is not logged in." \n
137  * 1004 Access denied. - "Insufficient rights to perform the requested operation."
138  */
139  void getConnectedInterface(out kerio::web::KId id);
140 
141  /**
142  * Returns type of login, that has to be performed
143  *
144  * @param type - type of login
145  */
146  [KAuthentication(AuthenticationMode.NO_AUTHENTICATION_REQUIRED)]
147  void getLoginType(out LoginType type);
148 };
149 
150 }; //webadmin
Definition: Session.idl:14
Definition: Session.idl:26
string name
E.g. "Simple server monitor".
Definition: Session.idl:15
Definition: Accounting.idl:11
string vendor
E.g. "MyScript Ltd.".
Definition: Session.idl:16
Definition: Session.idl:34
string version
E.g. "1.0.0 beta 1".
Definition: Session.idl:17