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-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 <libsignon-glib/signon-auth-session.h>
31 #include <libsignon-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:
50 * Opaque struct. Use the accessor functions below.
52 struct _SignonIdentityClass
54 GObjectClass parent_class;
60 * Opaque struct. Use the accessor functions below.
62 struct _SignonIdentity
64 GObject parent_instance;
65 SignonIdentityPrivate *priv;
69 * SignonIdentityVoidCb:
70 * @self: the #SignonIdentity.
71 * @error: a #GError if an error occurred, or %NULL otherwise.
72 * @user_data: the user data that was passed when installing this callback.
74 * Generic callback to be passed to several #SignonIdentity methods.
76 typedef void (*SignonIdentityVoidCb) (SignonIdentity *self,
81 * SignonIdentityRemovedCb:
83 * Callback to be passed to signon_identity_remove().
85 typedef SignonIdentityVoidCb SignonIdentityRemovedCb;
87 * SignonIdentitySignedOutCb:
89 * Callback to be passed to signon_identity_signout().
91 typedef SignonIdentityVoidCb SignonIdentitySignedOutCb;
93 * SignonIdentityReferenceAddedCb:
95 * Callback to be passed to signon_identity_add_reference().
97 typedef SignonIdentityVoidCb SignonIdentityReferenceAddedCb;
99 * SignonIdentityReferenceRemovedCb:
101 * Callback to be passed to signon_identity_remove_reference().
103 typedef SignonIdentityVoidCb SignonIdentityReferenceRemovedCb;
105 GType signon_identity_get_type (void) G_GNUC_CONST;
107 SignonIdentity *signon_identity_new_from_db (guint32 id,
108 const gchar *application_context);
109 SignonIdentity *signon_identity_new (const gchar *application_context);
111 const GError *signon_identity_get_last_error (SignonIdentity *identity);
113 SignonAuthSession *signon_identity_create_session(SignonIdentity *self,
118 * SignonIdentityStoreCredentialsCb:
119 * @self: the #SignonIdentity.
120 * @id: the numeric ID of the identity in the database.
121 * @error: a #GError if an error occurred, or %NULL otherwise.
122 * @user_data: the user data that was passed when installing this callback.
124 * Callback to be passed to signon_identity_store_credentials_with_args() or
125 * signon_identity_store_credentials_with_info().
127 typedef void (*SignonIdentityStoreCredentialsCb) (SignonIdentity *self,
132 void signon_identity_store_credentials_with_info(SignonIdentity *self,
133 const SignonIdentityInfo *info,
134 SignonIdentityStoreCredentialsCb cb,
137 void signon_identity_store_credentials_with_args(SignonIdentity *self,
138 const gchar *username,
140 const gboolean store_secret,
141 const GHashTable *methods,
142 const gchar *caption,
143 const gchar* const *realms,
144 const SignonSecurityContext *owner,
145 const SignonSecurityContextList *access_control_list,
146 SignonIdentityType type,
147 SignonIdentityStoreCredentialsCb cb,
151 * SignonIdentityVerifyCb:
152 * @self: the #SignonIdentity.
153 * @valid: whether the secret is valid.
154 * @error: a #GError if an error occurred, or %NULL otherwise.
155 * @user_data: the user data that was passed when installing this callback.
157 * Callback to be passed to signon_identity_verify_secret().
159 typedef void (*SignonIdentityVerifyCb) (SignonIdentity *self,
164 void signon_identity_verify_secret(SignonIdentity *self,
166 SignonIdentityVerifyCb cb,
170 * SignonIdentityInfoCb:
171 * @self: the #SignonIdentity.
172 * @info: the #SignonIdentityInfo for @self.
173 * @error: a #GError if an error occurred, or %NULL otherwise.
174 * @user_data: the user data that was passed when installing this callback.
176 * Callback to be passed to signon_identity_query_info().
178 typedef void (*SignonIdentityInfoCb) (SignonIdentity *self,
179 const SignonIdentityInfo *info,
183 void signon_identity_query_info(SignonIdentity *self,
184 SignonIdentityInfoCb cb,
187 void signon_identity_remove(SignonIdentity *self,
188 SignonIdentityRemovedCb cb,
191 void signon_identity_signout(SignonIdentity *self,
192 SignonIdentitySignedOutCb cb,
195 void signon_identity_add_reference(SignonIdentity *self,
196 const gchar *reference,
197 SignonIdentityReferenceAddedCb cb,
200 void signon_identity_remove_reference(SignonIdentity *self,
201 const gchar *reference,
202 SignonIdentityReferenceRemovedCb cb,
205 typedef void (*SignonIdentitySessionReadyCb) (SignonAuthSession *self,
207 GDBusConnection *connection,
208 const gchar *bus_name,
209 const gchar *object_path);
210 void signon_identity_get_auth_session(SignonIdentity *self,
211 SignonAuthSession *session,
213 SignonIdentitySessionReadyCb cb);
218 #endif /* _SIGNON_IDENTITY_H_ */