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 libgsignon-glib
6 * Copyright (C) 2009-2010 Nokia Corporation.
7 * Copyright (C) 2012 Canonical Ltd.
8 * Copyright (C) 2012-2013 Intel Corporation.
10 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
11 * Contact: Jussi Laako <jussi.laako@linux.intel.com>
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public License
15 * version 2.1 as published by the Free Software Foundation.
17 * This library is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 #ifndef SIGNONAUTHSESSION_H_
29 #define SIGNONAUTHSESSION_H_
32 #include <glib-object.h>
33 #include <libgsignon-glib/signon-types.h>
38 * Useful session data keys
41 * SIGNON_SESSION_DATA_USERNAME:
45 #define SIGNON_SESSION_DATA_USERNAME "UserName"
47 * SIGNON_SESSION_DATA_SECRET:
51 #define SIGNON_SESSION_DATA_SECRET "Secret"
53 * SIGNON_SESSION_DATA_REALM:
57 #define SIGNON_SESSION_DATA_REALM "Realm"
59 * SIGNON_SESSION_DATA_PROXY:
63 #define SIGNON_SESSION_DATA_PROXY "NetworkProxy"
66 * SignonSessionDataUiPolicy:
67 * @SIGNON_POLICY_DEFAULT: The plugin can decide when to show UI.
68 * @SIGNON_POLICY_REQUEST_PASSWORD: Force the user to enter the password.
69 * @SIGNON_POLICY_NO_USER_INTERACTION: No UI elements will be shown to the user.
70 * @SIGNON_POLICY_VALIDATION: UI elements can be shown to the user only when
71 * CAPTCHA-like security measures are required.
73 * UI policy for the signon process, passed to the UI plugin.
76 SIGNON_POLICY_DEFAULT = 0,
77 SIGNON_POLICY_REQUEST_PASSWORD,
78 SIGNON_POLICY_NO_USER_INTERACTION,
79 SIGNON_POLICY_VALIDATION,
80 } SignonSessionDataUiPolicy;
82 * SIGNON_SESSION_DATA_UI_POLICY:
83 * @see_also: #SignonSessionDataUiPolicy
85 * Policy for the signon process.
87 #define SIGNON_SESSION_DATA_UI_POLICY "UiPolicy"
89 * SIGNON_SESSION_DATA_CAPTION:
91 * Caption for the UI dialog.
93 #define SIGNON_SESSION_DATA_CAPTION "Caption"
95 * SIGNON_SESSION_DATA_TIMEOUT:
97 * Network timeout, in milliseconds (uint32).
99 #define SIGNON_SESSION_DATA_TIMEOUT "NetworkTimeout"
101 * SIGNON_SESSION_DATA_WINDOW_ID:
103 * Platform-specific window id (for dialog transiency) - uint32.
105 #define SIGNON_SESSION_DATA_WINDOW_ID "WindowId"
107 * SIGNON_SESSION_DATA_RENEW_TOKEN:
109 * Requests the signon plugin to obtain a new token (boolean).
111 #define SIGNON_SESSION_DATA_RENEW_TOKEN "RenewToken"
114 #define SIGNON_TYPE_AUTH_SESSION (signon_auth_session_get_type ())
115 #define SIGNON_AUTH_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIGNON_TYPE_AUTH_SESSION, SignonAuthSession))
116 #define SIGNON_AUTH_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIGNON_TYPE_AUTH_SESSION, SignonAuthSessionClass))
117 #define SIGNON_IS_AUTH_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIGNON_TYPE_AUTH_SESSION))
118 #define SIGNON_IS_AUTH_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIGNON_TYPE_AUTH_SESSION))
119 #define SIGNON_AUTH_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIGNON_TYPE_AUTH_SESSION, SignonAuthSessionClass))
121 typedef struct _SignonAuthSessionPrivate SignonAuthSessionPrivate;
122 typedef struct _SignonAuthSessionClass SignonAuthSessionClass;
127 * Opaque struct. Use the accessor functions below.
129 struct _SignonAuthSession {
132 SignonAuthSessionPrivate *priv;
136 * SignonAuthSessionClass:
137 * @parent: reference to the parent class
139 * Opaque struct. Use the accessor functions below.
141 struct _SignonAuthSessionClass {
145 GType signon_auth_session_get_type (void) G_GNUC_CONST;
147 SignonAuthSession *signon_auth_session_new(gint id,
148 const gchar *method_name,
152 signon_auth_session_new_for_identity(SignonIdentity *identity,
153 const gchar *method_name,
156 const gchar *signon_auth_session_get_method (SignonAuthSession *self);
158 typedef void (*SignonAuthSessionQueryAvailableMechanismsCb) (
159 SignonAuthSession* self,
165 typedef SignonAuthSessionQueryAvailableMechanismsCb
166 SignonAuthSessionQueryAvailableMethodsCb;
168 void signon_auth_session_query_available_mechanisms(SignonAuthSession *self,
169 const gchar **wanted_mechanisms,
170 SignonAuthSessionQueryAvailableMechanismsCb cb,
173 #ifndef SIGNON_DISABLE_DEPRECATED
174 typedef void (*SignonAuthSessionProcessCb) (SignonAuthSession *self,
175 GHashTable *session_data,
178 SIGNON_DEPRECATED_FOR(signon_auth_session_process_async)
179 void signon_auth_session_process(SignonAuthSession *self,
180 const GHashTable *session_data,
181 const gchar *mechanism,
182 SignonAuthSessionProcessCb cb,
185 void signon_auth_session_process_async (SignonAuthSession *self,
186 GVariant *session_data,
187 const gchar *mechanism,
188 GCancellable *cancellable,
189 GAsyncReadyCallback callback,
191 GVariant *signon_auth_session_process_finish (SignonAuthSession *self,
195 void signon_auth_session_cancel(SignonAuthSession *self);
199 #endif //SIGNONAUTHSESSIONIMPL_H_