common: make gsignond-identity-info.h private, as it's not used by anything in the...
[platform/upstream/gsignond.git] / src / daemon / gsignond-auth-session.h
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4  * This file is part of gsignond
5  *
6  * Copyright (C) 2013 Intel Corporation.
7  *
8  * Contact: Jussi Laako <jussi.laako@linux.intel.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23  * 02110-1301 USA
24  */
25
26 #ifndef _GSIGNOND_AUTH_SESSION_H_
27 #define _GSIGNOND_AUTH_SESSION_H_
28
29 #include <glib-object.h>
30
31 #include "gsignond-types.h"
32 #include <gsignond/gsignond-dictionary.h>
33 #include "common/gsignond-identity-info.h"
34 #include <gsignond/gsignond-signonui-data.h>
35 #include <gsignond/gsignond-session-data.h>
36 #include <gsignond/gsignond-access-control-manager.h>
37
38 G_BEGIN_DECLS
39
40 #define GSIGNOND_TYPE_AUTH_SESSION \
41     (gsignond_auth_session_get_type())
42 #define GSIGNOND_AUTH_SESSION(obj) \
43     (G_TYPE_CHECK_INSTANCE_CAST((obj), GSIGNOND_TYPE_AUTH_SESSION, \
44                                 GSignondAuthSession))
45 #define GSIGNOND_AUTH_SESSION_CLASS(klass) \
46     (G_TYPE_CHECK_CLASS_CAST((klass), GSIGNOND_TYPE_AUTH_SESSION, \
47                              GSignondAuthSessionClass))
48 #define GSIGNOND_IS_AUTH_SESSION(obj) \
49     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GSIGNOND_TYPE_AUTH_SESSION))
50 #define GSIGNOND_IS_AUTH_SESSION_CLASS(obj) \
51     (G_TYPE_CHECK_CLASS_TYPE((klass), GSIGNOND_TYPE_AUTH_SESSION))
52 #define GSIGNOND_AUTH_SESSION_GET_CLASS(obj) \
53     (G_TYPE_INSTANCE_GET_CLASS((obj), GSIGNOND_TYPE_AUTH_SESSION, \
54                                GSignondAuthSessionClass))
55
56 typedef struct _GSignondAuthSessionPrivate GSignondAuthSessionPrivate;
57 typedef void (*ProcessReadyCb) (GSignondSessionData *results, const GError *error, gpointer user_data);
58 typedef void (*StateChangeCb) (gint state, const gchar *message, gpointer userdata);
59
60 struct _GSignondAuthSession
61 {
62     GObject parent;
63
64     /* private */
65     GSignondAuthSessionPrivate *priv;
66 };
67
68 struct _GSignondAuthSessionClass
69 {
70     GObjectClass parent_class;
71 };
72
73 GType gsignond_auth_session_get_type (void);
74
75 gchar **
76 gsignond_auth_session_query_available_mechanisms (GSignondAuthSession *self,
77                                                   const gchar **wanted_mechanisms,
78                                                   const GSignondSecurityContext *ctx,
79                                                   GError **error);
80
81 gboolean
82 gsignond_auth_session_process (GSignondAuthSession *self,
83                                GSignondSessionData *session_data,
84                                const gchar *mechanism,
85                                const GSignondSecurityContext *ctx,
86                                ProcessReadyCb ready_cb,
87                                StateChangeCb state_change_cb,
88                                gpointer userdata,
89                                GError **error);
90 gboolean
91 gsignond_auth_session_cancel (GSignondAuthSession *self,
92                               const GSignondSecurityContext *ctx,
93                               GError **error);
94
95 void
96 gsignond_auth_session_abort_process (GSignondAuthSession *self);
97
98 void 
99 gsignond_auth_session_user_action_finished (GSignondAuthSession *self,
100                                             GSignondSignonuiData *ui_data);
101
102 void
103 gsignond_auth_session_refresh (GSignondAuthSession *self, 
104                                GSignondSignonuiData *ui_data);
105
106 const gchar *
107 gsignond_auth_session_get_method (GSignondAuthSession *session);
108
109 GSignondDictionary *
110 gsignond_auth_session_get_token_data (GSignondAuthSession *session);
111
112 GSignondAccessControlManager *
113 gsignond_auth_session_get_acm (GSignondAuthSession *session);
114
115 gboolean 
116 gsignond_auth_session_set_id(GSignondAuthSession *session, gint id);
117
118 void
119 gsignond_auth_session_notify_process_result (GSignondAuthSession *iface,
120                                              GSignondSessionData *result,
121                                              gpointer userdata);
122
123 void
124 gsignond_auth_session_notify_process_error (GSignondAuthSession *iface,
125                                             const GError *error,
126                                             gpointer userdata);
127 void 
128 gsignond_auth_session_notify_state_changed (GSignondAuthSession *self, 
129                                             gint state,
130                                             const gchar *message,
131                                             gpointer userdata);
132
133 void 
134 gsignond_auth_session_notify_store (GSignondAuthSession *self, 
135                                     GSignondDictionary *token_data);
136
137 void 
138 gsignond_auth_session_notify_user_action_required (GSignondAuthSession *self, 
139                                                    GSignondSignonuiData *ui_data);
140
141 void 
142 gsignond_auth_session_notify_refreshed (GSignondAuthSession *self, 
143                                         GSignondSignonuiData *ui_data);
144
145 GSignondAuthSession * 
146 gsignond_auth_session_new (GSignondIdentityInfo *info,
147                            const gchar *method,
148                            GSignondDictionary *token_data);
149
150 G_END_DECLS
151
152 #endif  /* _GSIGNOND_AUTH_SESSION_H_ */
153