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 const gchar *application_context);
110 SignonIdentity *signon_identity_new (const gchar *application_context);
112 const GError *signon_identity_get_last_error (SignonIdentity *identity);
114 SignonAuthSession *signon_identity_create_session(SignonIdentity *self,
119 * SignonIdentityStoreCredentialsCb:
120 * @self: the #SignonIdentity.
121 * @id: the numeric ID of the identity in the database.
122 * @error: a #GError if an error occurred, or %NULL otherwise.
123 * @user_data: the user data that was passed when installing this callback.
125 * Callback to be passed to signon_identity_store_credentials_with_args() or
126 * signon_identity_store_credentials_with_info().
128 typedef void (*SignonIdentityStoreCredentialsCb) (SignonIdentity *self,
133 void signon_identity_store_credentials_with_info(SignonIdentity *self,
134 const SignonIdentityInfo *info,
135 SignonIdentityStoreCredentialsCb cb,
138 void signon_identity_store_credentials_with_args(SignonIdentity *self,
139 const gchar *username,
141 const gboolean store_secret,
142 const GHashTable *methods,
143 const gchar *caption,
144 const gchar* const *realms,
145 const SignonSecurityContext *owner,
146 const SignonSecurityContextList *access_control_list,
147 SignonIdentityType type,
148 SignonIdentityStoreCredentialsCb cb,
152 * SignonIdentityVerifyCb:
153 * @self: the #SignonIdentity.
154 * @valid: whether the secret is valid.
155 * @error: a #GError if an error occurred, or %NULL otherwise.
156 * @user_data: the user data that was passed when installing this callback.
158 * Callback to be passed to signon_identity_verify_secret().
160 typedef void (*SignonIdentityVerifyCb) (SignonIdentity *self,
165 void signon_identity_verify_secret(SignonIdentity *self,
167 SignonIdentityVerifyCb cb,
171 * SignonIdentityInfoCb:
172 * @self: the #SignonIdentity.
173 * @info: the #SignonIdentityInfo for @self.
174 * @error: a #GError if an error occurred, or %NULL otherwise.
175 * @user_data: the user data that was passed when installing this callback.
177 * Callback to be passed to signon_identity_query_info().
179 typedef void (*SignonIdentityInfoCb) (SignonIdentity *self,
180 const SignonIdentityInfo *info,
184 void signon_identity_query_info(SignonIdentity *self,
185 SignonIdentityInfoCb cb,
188 void signon_identity_remove(SignonIdentity *self,
189 SignonIdentityRemovedCb cb,
192 void signon_identity_signout(SignonIdentity *self,
193 SignonIdentitySignedOutCb cb,
196 void signon_identity_add_reference(SignonIdentity *self,
197 const gchar *reference,
198 SignonIdentityReferenceAddedCb cb,
201 void signon_identity_remove_reference(SignonIdentity *self,
202 const gchar *reference,
203 SignonIdentityReferenceRemovedCb cb,
207 * SignonIdentitySessionReadyCb:
208 * @self: the #SignonAuthSession.
209 * @error: a #GError if an error occurred, or %NULL otherwise.
210 * @connection: a #GDBusConnection for the session.
211 * @bus_name: a D-Bus bus name for the session.
212 * @object_path: a D-Bus object path for the session.
214 * Callback to be passed to signon_identity_get_auth_session().
216 typedef void (*SignonIdentitySessionReadyCb) (SignonAuthSession *self,
218 GDBusConnection *connection,
219 const gchar *bus_name,
220 const gchar *object_path);
221 void signon_identity_get_auth_session(SignonIdentity *self,
222 SignonAuthSession *session,
224 SignonIdentitySessionReadyCb cb);
229 #endif /* _SIGNON_IDENTITY_H_ */