1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
4 * This file is part of gsignond
6 * Copyright (C) 2012-2013 Intel Corporation.
8 * Contact: Alexander Kanavin <alex.kanavin@gmail.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 #include <gsignond/gsignond-session-data.h>
30 * SECTION:gsignond-session-data
31 * @short_description: definitions for authentication session parameters
32 * @title: GSignondSessionData
33 * @include: gsignond/gsignond-session-data.h
35 * This file provides commonly used parameters for authentication sessions.
36 * For each of those a getter and setter is defined, on #GSignondSessionData
37 * container. The plugins may not use all of these parameters, and they commonly
38 * require additional, custom parameters which are set using #GSignondDictionary
39 * setters with explicit key string.
44 * GSignondSessionData:
46 * #GSignondSessionData is simply a typedef for #GSignondDictionary, which
47 * means the developers may also freely use methods associated with that structure,
48 * in particular for creating a #GSignondSessionData object with
49 * gsignond_dictionary_new().
54 * @GSIGNOND_UI_POLICY_DEFAULT: use a default user interaction scenario
55 * @GSIGNOND_UI_POLICY_REQUEST_PASSWORD: force an authorization request from the user;
56 * any cached access tokens should be discarded by the plugin.
57 * @GSIGNOND_UI_POLICY_NO_USER_INTERACTION: force no interaction with the user
58 * @GSIGNOND_UI_POLICY_VALIDATION: interaction with the user is only allowed
59 * for validation captchas and similar security measures
61 * Policy setting to define how plugins should handle interaction with the user.
65 * gsignond_session_data_get_username:
66 * @data: a #GSignondDictionary structure
68 * A getter for a username associated with the authentication session.
70 * Returns: (transfer none)
73 gsignond_session_data_get_username (GSignondSessionData *data)
75 return gsignond_dictionary_get_string (data, "UserName");
79 * gsignond_session_data_set_username:
80 * @data: a #GSignondDictionary structure
81 * @username: username to set
83 * A setter for a username associated with the authentication session.
86 gsignond_session_data_set_username (GSignondSessionData *data,
87 const gchar *username)
89 gsignond_dictionary_set_string (data, "UserName", username);
93 * gsignond_session_data_get_secret:
94 * @data: a #GSignondDictionary structure
96 * A getter for a secret (e.g. a password) associated with the authentication session.
98 * Returns: (transfer none)
101 gsignond_session_data_get_secret (GSignondSessionData *data)
103 return gsignond_dictionary_get_string (data, "Secret");
107 * gsignond_session_data_set_secret:
108 * @data: a #GSignondDictionary structure
109 * @secret: a secret to set
111 * A setter for a secret (e.g. a password) associated with the authentication session.
114 gsignond_session_data_set_secret (GSignondSessionData *data,
117 gsignond_dictionary_set_string (data, "Secret", secret);
121 * gsignond_session_data_get_realm:
122 * @data: a #GSignondDictionary structure
124 * A getter for a realm associated with the authentication session.
126 * Returns: (transfer none)
129 gsignond_session_data_get_realm (GSignondSessionData *data)
131 return gsignond_dictionary_get_string (data, "Realm");
135 * gsignond_session_data_set_realm:
136 * @data: a #GSignondDictionary structure
137 * @realm: a realm to set
139 * A setter for a realm associated with the authentication session.
142 gsignond_session_data_set_realm (GSignondSessionData *data,
145 gsignond_dictionary_set_string (data, "Realm", realm);
149 * gsignond_session_data_get_caption:
150 * @data: a #GSignondDictionary structure
152 * A getter for a caption associated with the authentication session.
153 * Caption tells the user which application/credentials/provider is requestion
156 * Returns: (transfer none)
159 gsignond_session_data_get_caption (GSignondSessionData *data)
161 return gsignond_dictionary_get_string (data, "Caption");
165 * gsignond_session_data_set_caption:
166 * @data: a #GSignondDictionary structure
167 * @caption: a caption to set
169 * A setter for a caption associated with the authentication session.
170 * Caption tells the user which application/credentials/provider is requestion
174 gsignond_session_data_set_caption (GSignondSessionData *data,
175 const gchar *caption)
177 gsignond_dictionary_set_string (data, "Caption", caption);
181 * gsignond_session_data_get_renew_token:
182 * @data: a #GSignondDictionary structure
183 * @renew_token: the value for the parameter is written here
185 * A getter for a renew token property associated with the authentication session.
186 * This property tells the plugin to discard any cached tokens and start
187 * the authentication process anew.
189 * Returns: whether the key-value pair exists in the @data dictionary or not.
192 gsignond_session_data_get_renew_token (GSignondSessionData *data,
193 gboolean *renew_token)
195 return gsignond_dictionary_get_boolean (data, "RenewToken", renew_token);
199 * gsignond_session_data_set_renew_token:
200 * @data: a #GSignondDictionary structure
201 * @renew_token: whether to renew the token set
203 * A setter for a renew token property associated with the authentication session.
204 * This property tells the plugin to discard any cached tokens and start
205 * the authentication process anew.
208 gsignond_session_data_set_renew_token (GSignondSessionData *data,
209 gboolean renew_token)
211 gsignond_dictionary_set_boolean (data, "RenewToken", renew_token);
215 * gsignond_session_data_get_ui_policy:
216 * @data: a #GSignondDictionary structure
217 * @ui_policy: the value for the parameter is written here
219 * A getter for UI policy setting associated with the authentication session.
220 * The UI policy indicates how the authentication plugin should interact with the user.
222 * Returns: whether the key-value pair exists in the @data dictionary or not.
225 gsignond_session_data_get_ui_policy (GSignondSessionData *data,
226 GSignondUiPolicy *ui_policy)
228 return gsignond_dictionary_get_uint32 (data, "UiPolicy", ui_policy);
232 * gsignond_session_data_set_ui_policy:
233 * @data: a #GSignondDictionary structure
234 * @ui_policy: ui policy to set
236 * A getter for UI policy setting associated with the authentication session.
237 * The UI policy indicates how the authentication plugin should interact with the user.
240 gsignond_session_data_set_ui_policy (GSignondSessionData *data,
241 GSignondUiPolicy ui_policy)
243 gsignond_dictionary_set_uint32 (data, "UiPolicy", ui_policy);
247 * gsignond_session_data_get_network_proxy:
248 * @data: a #GSignondDictionary structure
250 * A getter for a network proxy setting associated with the authentication session.
251 * If this property is not set, the default system proxy settings should be used.
253 * Returns: (transfer none)
256 gsignond_session_data_get_network_proxy (GSignondSessionData *data)
258 return gsignond_dictionary_get_string (data, "NetworkProxy");
262 * gsignond_session_data_set_network_proxy:
263 * @data: a #GSignondDictionary structure
264 * @network_proxy: network proxy to use
266 * A setter for a network proxy setting associated with the authentication session.
267 * If this property is not set, the default system proxy settings should be used.
270 gsignond_session_data_set_network_proxy (GSignondSessionData *data,
271 const gchar *network_proxy)
273 gsignond_dictionary_set_string (data, "NetworkProxy", network_proxy);
277 * gsignond_session_data_get_network_timeout:
278 * @data: a #GSignondDictionary structure
279 * @network_timeout: the value for the parameter is written here
281 * A getter for a network timeout setting associated with the authentication session.
282 * This can be used to change the default timeout in case of unresponsive servers.
284 * Returns: whether the key-value pair exists in the @data dictionary or not.
287 gsignond_session_data_get_network_timeout (GSignondSessionData *data,
288 guint32 *network_timeout)
290 return gsignond_dictionary_get_uint32 (data, "NetworkTimeout",
295 * gsignond_session_data_set_network_timeout:
296 * @data: a #GSignondDictionary structure
297 * @network_timeout: network timeout to use
299 * A setter for a network timeout setting associated with the authentication session.
300 * This can be used to change the default timeout in case of unresponsive servers.
303 gsignond_session_data_set_network_timeout (GSignondSessionData *data,
304 guint32 network_timeout)
306 gsignond_dictionary_set_uint32 (data, "NetworkTimeout",
311 * gsignond_session_data_get_window_id:
312 * @data: a #GSignondDictionary structure
313 * @window_id: the value for the parameter is written here
315 * A getter for a window id setting associated with the authentication session.
316 * This can be used to embed the user interaction window produced by the authentication
317 * session into an application window.
319 * Returns: whether the key-value pair exists in the @data dictionary or not.
322 gsignond_session_data_get_window_id (GSignondSessionData *data,
325 return gsignond_dictionary_get_uint32 (data, "WindowId", window_id);
329 * gsignond_session_data_set_window_id:
330 * @data: a #GSignondDictionary structure
331 * @window_id: window id to use
333 * A setter for a window id setting associated with the authentication session.
334 * This can be used to embed the user interaction window produced by the authentication
335 * session into an application window.
338 gsignond_session_data_set_window_id (GSignondSessionData *data,
341 gsignond_dictionary_set_uint32 (data, "WindowId", window_id);