updated changelog
[platform/upstream/evolution-data-server.git] / libebackend / e-authentication-session.h
1 /*
2  * e-authentication-session.h
3  *
4  * This library is free software you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17
18 #if !defined (__LIBEBACKEND_H_INSIDE__) && !defined (LIBEBACKEND_COMPILATION)
19 #error "Only <libebackend/libebackend.h> should be included directly."
20 #endif
21
22 #ifndef E_AUTHENTICATION_SESSION_H
23 #define E_AUTHENTICATION_SESSION_H
24
25 #include <gio/gio.h>
26
27 #include <libedataserver/libedataserver.h>
28
29 #include <libebackend/e-backend-enums.h>
30
31 /* Standard GObject macros */
32 #define E_TYPE_AUTHENTICATION_SESSION \
33         (e_authentication_session_get_type ())
34 #define E_AUTHENTICATION_SESSION(obj) \
35         (G_TYPE_CHECK_INSTANCE_CAST \
36         ((obj), E_TYPE_AUTHENTICATION_SESSION, EAuthenticationSession))
37 #define E_AUTHENTICATION_SESSION_CLASS(cls) \
38         (G_TYPE_CHECK_CLASS_CAST \
39         ((cls), E_TYPE_AUTHENTICATION_SESSION, EAuthenticationSessionClass))
40 #define E_IS_AUTHENTICATION_SESSION(obj) \
41         (G_TYPE_CHECK_INSTANCE_TYPE \
42         ((obj), E_TYPE_AUTHENTICATION_SESSION))
43 #define E_IS_AUTHENTICATION_SESSION_CLASS(cls) \
44         (G_TYPE_CHECK_CLASS_TYPE \
45         ((cls), E_TYPE_AUTHENTICATION_SESSION))
46 #define E_AUTHENTICATION_SESSION_GET_CLASS(obj) \
47         (G_TYPE_INSTANCE_GET_CLASS \
48         ((obj), E_TYPE_AUTHENTICATION_SESSION, EAuthenticationSessionClass))
49
50 G_BEGIN_DECLS
51
52 struct _ESourceRegistryServer;
53
54 typedef struct _EAuthenticationSession EAuthenticationSession;
55 typedef struct _EAuthenticationSessionClass EAuthenticationSessionClass;
56 typedef struct _EAuthenticationSessionPrivate EAuthenticationSessionPrivate;
57
58 /**
59  * EAuthenticationSession:
60  *
61  * Contains only private data that should be read and manipulated using the
62  * functions below.
63  *
64  * Since: 3.6
65  **/
66 struct _EAuthenticationSession {
67         /*< private >*/
68         GObject parent;
69         EAuthenticationSessionPrivate *priv;
70 };
71
72 /**
73  * EAuthenticationSessionClass:
74  * @execute_sync: Authenticate synchronously
75  * @execute: Initiate authentication
76  * @execute_finish: Complete authentication
77  *
78  * Class structure for the #EAuthenticationSession object
79  *
80  * Since: 3.6
81  */
82 struct _EAuthenticationSessionClass {
83         /*< private >*/
84         GObjectClass parent_class;
85
86         /*< public >*/
87
88         /* Methods */
89         EAuthenticationSessionResult
90                         (*execute_sync) (EAuthenticationSession *session,
91                                          GCancellable *cancellable,
92                                          GError **error);
93         void            (*execute)      (EAuthenticationSession *session,
94                                          gint io_priority,
95                                          GCancellable *cancellable,
96                                          GAsyncReadyCallback callback,
97                                          gpointer user_data);
98         EAuthenticationSessionResult
99                         (*execute_finish)
100                                         (EAuthenticationSession *session,
101                                          GAsyncResult *result,
102                                          GError **error);
103
104         /*< private >*/
105         /* Reserved slots. */
106         gpointer reserved[16];
107 };
108
109 GQuark          e_authentication_session_error_quark
110                                         (void) G_GNUC_CONST;
111 GType           e_authentication_session_get_type
112                                         (void) G_GNUC_CONST;
113 struct _ESourceRegistryServer *
114                 e_authentication_session_get_server
115                                         (EAuthenticationSession *session);
116 ESourceAuthenticator *
117                 e_authentication_session_get_authenticator
118                                         (EAuthenticationSession *session);
119 const gchar *   e_authentication_session_get_source_uid
120                                         (EAuthenticationSession *session);
121 const gchar *   e_authentication_session_get_prompt_title
122                                         (EAuthenticationSession *session);
123 gchar *         e_authentication_session_dup_prompt_title
124                                         (EAuthenticationSession *session);
125 void            e_authentication_session_set_prompt_title
126                                         (EAuthenticationSession *session,
127                                          const gchar *prompt_title);
128 const gchar *   e_authentication_session_get_prompt_message
129                                         (EAuthenticationSession *session);
130 gchar *         e_authentication_session_dup_prompt_message
131                                         (EAuthenticationSession *session);
132 void            e_authentication_session_set_prompt_message
133                                         (EAuthenticationSession *session,
134                                          const gchar *prompt_message);
135 const gchar *   e_authentication_session_get_prompt_description
136                                         (EAuthenticationSession *session);
137 gchar *         e_authentication_session_dup_prompt_description
138                                         (EAuthenticationSession *session);
139 void            e_authentication_session_set_prompt_description
140                                         (EAuthenticationSession *session,
141                                          const gchar *prompt_description);
142 EAuthenticationSessionResult
143                 e_authentication_session_execute_sync
144                                         (EAuthenticationSession *session,
145                                          GCancellable *cancellable,
146                                          GError **error);
147 void            e_authentication_session_execute
148                                         (EAuthenticationSession *session,
149                                          gint io_priority,
150                                          GCancellable *cancellable,
151                                          GAsyncReadyCallback callback,
152                                          gpointer user_data);
153 EAuthenticationSessionResult
154                 e_authentication_session_execute_finish
155                                         (EAuthenticationSession *session,
156                                          GAsyncResult *result,
157                                          GError **error);
158
159 #ifndef EDS_DISABLE_DEPRECATED
160 /**
161  * E_AUTHENTICATION_SESSION_KEYRING_ERROR:
162  *
163  * Error domain for password storage and retrieval.
164  *
165  * No longer used.
166  *
167  * Since: 3.6
168  *
169  * Deprecated: 3.8: The #SECRET_ERROR domain is now used instead.
170  **/
171 #define E_AUTHENTICATION_SESSION_KEYRING_ERROR \
172         (e_authentication_session_error_quark ())
173
174 EAuthenticationSession *
175                 e_authentication_session_new
176                                         (struct _ESourceRegistryServer *server,
177                                          ESourceAuthenticator *authenticator,
178                                          const gchar *source_uid);
179 gboolean        e_authentication_session_store_password_sync
180                                         (EAuthenticationSession *session,
181                                          const gchar *password,
182                                          gboolean permanently,
183                                          GCancellable *cancellable,
184                                          GError **error);
185 void            e_authentication_session_store_password
186                                         (EAuthenticationSession *session,
187                                          const gchar *password,
188                                          gboolean permanently,
189                                          gint io_priority,
190                                          GCancellable *cancellable,
191                                          GAsyncReadyCallback callback,
192                                          gpointer user_data);
193 gboolean        e_authentication_session_store_password_finish
194                                         (EAuthenticationSession *session,
195                                          GAsyncResult *result,
196                                          GError **error);
197 gboolean        e_authentication_session_lookup_password_sync
198                                         (EAuthenticationSession *session,
199                                          GCancellable *cancellable,
200                                          gchar **password,
201                                          GError **error);
202 void            e_authentication_session_lookup_password
203                                         (EAuthenticationSession *session,
204                                          gint io_priority,
205                                          GCancellable *cancellable,
206                                          GAsyncReadyCallback callback,
207                                          gpointer user_data);
208 gboolean        e_authentication_session_lookup_password_finish
209                                         (EAuthenticationSession *session,
210                                          GAsyncResult *result,
211                                          gchar **password,
212                                          GError **error);
213 gboolean        e_authentication_session_delete_password_sync
214                                         (EAuthenticationSession *session,
215                                          GCancellable *cancellable,
216                                          GError **error);
217 void            e_authentication_session_delete_password
218                                         (EAuthenticationSession *session,
219                                          gint io_priority,
220                                          GCancellable *cancellable,
221                                          GAsyncReadyCallback callback,
222                                          gpointer user_data);
223 gboolean        e_authentication_session_delete_password_finish
224                                         (EAuthenticationSession *session,
225                                          GAsyncResult *result,
226                                          GError **error);
227 #endif /* EDS_DISABLE_DEPRECATED */
228
229 G_END_DECLS
230
231 #endif /* E_AUTHENTICATION_SESSION_H */
232