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 libsignon-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 <libsignon-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 * 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 _SignonAuthSession SignonAuthSession;
122 typedef struct _SignonAuthSessionPrivate SignonAuthSessionPrivate;
123 typedef struct _SignonAuthSessionClass SignonAuthSessionClass;
128 * Opaque struct. Use the accessor functions below.
130 struct _SignonAuthSession {
133 SignonAuthSessionPrivate *priv;
137 * SignonAuthSessionClass:
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(GObject *parent,
148 const gchar *method_name,
151 const gchar *signon_auth_session_get_method (SignonAuthSession *self);
153 typedef void (*SignonAuthSessionQueryAvailableMechanismsCb) (
154 SignonAuthSession* self,
160 typedef SignonAuthSessionQueryAvailableMechanismsCb
161 SignonAuthSessionQueryAvailableMethodsCb;
163 void signon_auth_session_query_available_mechanisms(SignonAuthSession *self,
164 const gchar **wanted_mechanisms,
165 SignonAuthSessionQueryAvailableMechanismsCb cb,
168 #ifndef SIGNON_DISABLE_DEPRECATED
169 typedef void (*SignonAuthSessionProcessCb) (SignonAuthSession *self,
170 GHashTable *session_data,
173 SIGNON_DEPRECATED_FOR(signon_auth_session_process_async)
174 void signon_auth_session_process(SignonAuthSession *self,
175 const GHashTable *session_data,
176 const gchar *mechanism,
177 SignonAuthSessionProcessCb cb,
180 void signon_auth_session_process_async (SignonAuthSession *self,
181 GVariant *session_data,
182 const gchar *mechanism,
183 GCancellable *cancellable,
184 GAsyncReadyCallback callback,
186 GVariant *signon_auth_session_process_finish (SignonAuthSession *self,
190 void signon_auth_session_cancel(SignonAuthSession *self);
194 #endif //SIGNONAUTHSESSIONIMPL_H_