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-2013 Intel Corporation.
9 * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
10 * Contact: Jussi Laako <jussi.laako@linux.intel.com>
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * version 2.1 as published by the Free Software Foundation.
16 * This library is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27 #ifndef _SIGNON_IDENTITY_H_
28 #define _SIGNON_IDENTITY_H_
30 #include <libgsignon-glib/signon-auth-session.h>
31 #include <libgsignon-glib/signon-identity-info.h>
32 #include <glib-object.h>
36 #define SIGNON_TYPE_IDENTITY (signon_identity_get_type ())
37 #define SIGNON_IDENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIGNON_TYPE_IDENTITY, SignonIdentity))
38 #define SIGNON_IDENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIGNON_TYPE_IDENTITY, SignonIdentityClass))
39 #define SIGNON_IS_IDENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIGNON_TYPE_IDENTITY))
40 #define SIGNON_IS_IDENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIGNON_TYPE_IDENTITY))
41 #define SIGNON_IDENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIGNON_TYPE_IDENTITY, SignonIdentityClass))
43 typedef struct _SignonIdentityClass SignonIdentityClass;
44 typedef struct _SignonIdentityPrivate SignonIdentityPrivate;
45 typedef struct _SignonIdentity SignonIdentity;
48 * SignonIdentityClass:
49 * @parent_class: reference to a parent class
51 * Opaque struct. Use the accessor functions below.
53 struct _SignonIdentityClass
55 GObjectClass parent_class;
61 * Opaque struct. Use the accessor functions below.
63 struct _SignonIdentity
65 GObject parent_instance;
66 SignonIdentityPrivate *priv;
70 * SignonIdentityVoidCb:
71 * @self: the #SignonIdentity.
72 * @error: a #GError if an error occurred, or %NULL otherwise.
73 * @user_data: the user data that was passed when installing this callback.
75 * Generic callback to be passed to several #SignonIdentity methods.
77 typedef void (*SignonIdentityVoidCb) (SignonIdentity *self,
82 * SignonIdentityRemovedCb:
84 * Callback to be passed to signon_identity_remove().
86 typedef SignonIdentityVoidCb SignonIdentityRemovedCb;
88 * SignonIdentitySignedOutCb:
90 * Callback to be passed to signon_identity_signout().
92 typedef SignonIdentityVoidCb SignonIdentitySignedOutCb;
94 * SignonIdentityReferenceAddedCb:
96 * Callback to be passed to signon_identity_add_reference().
98 typedef SignonIdentityVoidCb SignonIdentityReferenceAddedCb;
100 * SignonIdentityReferenceRemovedCb:
102 * Callback to be passed to signon_identity_remove_reference().
104 typedef SignonIdentityVoidCb SignonIdentityReferenceRemovedCb;
106 GType signon_identity_get_type (void) G_GNUC_CONST;
108 SignonIdentity *signon_identity_new_from_db (guint32 id);
109 SignonIdentity *signon_identity_new ();
111 SignonIdentity *signon_identity_new_with_context_from_db (guint32 id,
112 const gchar *application_context);
113 SignonIdentity *signon_identity_new_with_context (const gchar *application_context);
115 const GError *signon_identity_get_last_error (SignonIdentity *identity);
117 SignonAuthSession *signon_identity_create_session(SignonIdentity *self,
122 * SignonIdentityStoreCredentialsCb:
123 * @self: the #SignonIdentity.
124 * @id: the numeric ID of the identity in the database.
125 * @error: a #GError if an error occurred, or %NULL otherwise.
126 * @user_data: the user data that was passed when installing this callback.
128 * Callback to be passed to signon_identity_store_credentials_with_args() or
129 * signon_identity_store_credentials_with_info().
131 typedef void (*SignonIdentityStoreCredentialsCb) (SignonIdentity *self,
136 void signon_identity_store_credentials_with_info(SignonIdentity *self,
137 const SignonIdentityInfo *info,
138 SignonIdentityStoreCredentialsCb cb,
141 void signon_identity_store_credentials_with_args(SignonIdentity *self,
142 const gchar *username,
144 const gboolean store_secret,
145 const GHashTable *methods,
146 const gchar *caption,
147 const gchar* const *realms,
148 const SignonSecurityContext *owner,
149 const SignonSecurityContextList *access_control_list,
150 SignonIdentityType type,
151 SignonIdentityStoreCredentialsCb cb,
155 * SignonIdentityVerifyCb:
156 * @self: the #SignonIdentity.
157 * @valid: whether the secret is valid.
158 * @error: a #GError if an error occurred, or %NULL otherwise.
159 * @user_data: the user data that was passed when installing this callback.
161 * Callback to be passed to signon_identity_verify_secret().
163 typedef void (*SignonIdentityVerifyCb) (SignonIdentity *self,
168 void signon_identity_verify_secret(SignonIdentity *self,
170 SignonIdentityVerifyCb cb,
174 * SignonIdentityInfoCb:
175 * @self: the #SignonIdentity.
176 * @info: the #SignonIdentityInfo for @self.
177 * @error: a #GError if an error occurred, or %NULL otherwise.
178 * @user_data: the user data that was passed when installing this callback.
180 * Callback to be passed to signon_identity_query_info().
182 typedef void (*SignonIdentityInfoCb) (SignonIdentity *self,
183 const SignonIdentityInfo *info,
187 void signon_identity_query_info(SignonIdentity *self,
188 SignonIdentityInfoCb cb,
191 void signon_identity_remove(SignonIdentity *self,
192 SignonIdentityRemovedCb cb,
195 void signon_identity_signout(SignonIdentity *self,
196 SignonIdentitySignedOutCb cb,
199 void signon_identity_add_reference(SignonIdentity *self,
200 const gchar *reference,
201 SignonIdentityReferenceAddedCb cb,
204 void signon_identity_remove_reference(SignonIdentity *self,
205 const gchar *reference,
206 SignonIdentityReferenceRemovedCb cb,
210 * SignonIdentitySessionReadyCb:
211 * @self: the #SignonAuthSession.
212 * @error: a #GError if an error occurred, or %NULL otherwise.
213 * @connection: a #GDBusConnection for the session.
214 * @bus_name: a D-Bus bus name for the session.
215 * @object_path: a D-Bus object path for the session.
217 * Callback to be passed to signon_identity_get_auth_session().
219 typedef void (*SignonIdentitySessionReadyCb) (SignonAuthSession *self,
221 GDBusConnection *connection,
222 const gchar *bus_name,
223 const gchar *object_path);
224 void signon_identity_get_auth_session(SignonIdentity *self,
225 SignonAuthSession *session,
227 SignonIdentitySessionReadyCb cb);
232 #endif /* _SIGNON_IDENTITY_H_ */