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 Canonical Ltd.
8 * Copyright (C) 2012-2013 Intel Corporation.
10 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
11 * Contact: Jussi Laako <jussi.laako@linux.intel.com>
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public License
15 * version 2.1 as published by the Free Software Foundation.
17 * This library is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
29 * SECTION:signon-auth-session
30 * @title: SignonAuthSession
31 * @short_description: Authentication session handler.
33 * The #SignonAuthSession object is responsible for handling the client
34 * authentication. #SignonAuthSession objects can be created from existing
35 * identities (via signon_identity_create_session() or by passing a non-zero ID
36 * to signon_auth_session_new()), in which case the authentication data such as
37 * username and password will be implicitly taken from the identity, or they
38 * can be created with no existing identity bound to them, in which case all
39 * the authentication data must be filled in by the client when
40 * signon_auth_session_process() is called.
43 #include "signon-internals.h"
44 #include "signon-auth-session.h"
45 #include "signon-dbus-queue.h"
46 #include "signon-errors.h"
47 #include "signon-marshal.h"
48 #include "signon-utils.h"
49 #include "signon-identity.h"
50 #include "sso-auth-service.h"
51 #include "sso-auth-session-gen.h"
54 G_DEFINE_TYPE (SignonAuthSession, signon_auth_session, G_TYPE_OBJECT);
70 static guint auth_session_signals[LAST_SIGNAL] = { 0 };
71 static const gchar auth_session_process_pending_message[] =
72 "The request is added to queue.";
73 static const gchar data_key_process[] = "signon-process";
75 struct _SignonAuthSessionPrivate
77 SsoAuthSession *proxy;
78 SignonIdentity *identity;
79 GCancellable *cancellable;
87 gboolean dispose_has_run;
89 guint signal_state_changed;
90 guint signal_unregistered;
93 typedef struct _AuthSessionQueryAvailableMechanismsData
95 gchar **wanted_mechanisms;
97 } AuthSessionQueryAvailableMechanismsData;
99 typedef struct _AuthSessionProcessData
101 GVariant *session_data;
103 GCancellable *cancellable;
104 } AuthSessionProcessData;
106 typedef struct _AuthSessionQueryAvailableMechanismsCbData
108 SignonAuthSession *self;
109 SignonAuthSessionQueryAvailableMechanismsCb cb;
111 } AuthSessionQueryAvailableMechanismsCbData;
113 typedef struct _AuthSessionProcessCbData
115 SignonAuthSessionProcessCb cb;
117 } AuthSessionProcessCbData;
119 #define SIGNON_AUTH_SESSION_PRIV(obj) (SIGNON_AUTH_SESSION(obj)->priv)
120 #define SIGNON_AUTH_SESSION_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SIGNON_TYPE_AUTH_SESSION, SignonAuthSessionPrivate))
123 static void auth_session_state_changed_cb (GDBusProxy *proxy, gint state, gchar *message, gpointer user_data);
124 static void auth_session_remote_object_destroyed_cb (GDBusProxy *proxy, gpointer user_data);
126 static gboolean auth_session_priv_init (SignonAuthSession *self, const gchar *method_name, GError **err);
128 static void auth_session_query_available_mechanisms_ready_cb (gpointer object, const GError *error, gpointer user_data);
129 static void auth_session_cancel_ready_cb (gpointer object, const GError *error, gpointer user_data);
131 static void auth_session_check_remote_object(SignonAuthSession *self);
134 auth_session_process_data_free (AuthSessionProcessData *process_data)
136 g_free (process_data->mechanism);
137 g_variant_unref (process_data->session_data);
138 g_slice_free (AuthSessionProcessData, process_data);
142 auth_session_process_reply (GObject *object, GAsyncResult *res,
145 SignonAuthSession *self;
146 SsoAuthSession *proxy = SSO_AUTH_SESSION (object);
147 GSimpleAsyncResult *res_process = (GSimpleAsyncResult *)userdata;
149 GError *error = NULL;
151 g_return_if_fail (res_process != NULL);
152 DEBUG ("%s %d", G_STRFUNC, __LINE__);
154 sso_auth_session_call_process_finish (proxy, &reply, res, &error);
156 self = SIGNON_AUTH_SESSION (g_async_result_get_source_object (
157 (GAsyncResult *)res_process));
158 self->priv->busy = FALSE;
160 if (G_LIKELY (error == NULL))
162 g_simple_async_result_set_op_res_gpointer (res_process, reply,
168 g_simple_async_result_take_error (res_process, error);
171 /* We use the idle variant in order to avoid the following critical
173 * g_main_context_pop_thread_default: assertion `g_queue_peek_head (stack) == context' failed
175 g_simple_async_result_complete_in_idle (res_process);
176 g_object_unref (self);
180 auth_session_process_ready_cb (gpointer object, const GError *error, gpointer user_data)
182 SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
183 SignonAuthSessionPrivate *priv;
184 GSimpleAsyncResult *res = G_SIMPLE_ASYNC_RESULT (user_data);
185 AuthSessionProcessData *process_data;
187 g_return_if_fail (self != NULL);
192 DEBUG ("AuthSessionError: %s", error->message);
193 g_simple_async_result_set_from_error (res, error);
194 g_simple_async_result_complete (res);
201 priv->canceled = FALSE;
202 g_simple_async_result_set_error (res,
203 signon_error_quark (),
204 SIGNON_ERROR_SESSION_CANCELED,
205 "Authentication session was canceled");
206 g_simple_async_result_complete (res);
210 DEBUG ("%s %d", G_STRFUNC, __LINE__);
212 process_data = g_object_get_data ((GObject *)res, data_key_process);
213 g_return_if_fail (process_data != NULL);
215 sso_auth_session_call_process (priv->proxy,
216 process_data->session_data,
217 process_data->mechanism,
218 process_data->cancellable,
219 auth_session_process_reply,
224 process_async_cb_wrapper (GObject *object, GAsyncResult *res,
227 AuthSessionProcessCbData *cb_data = user_data;
228 SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
230 GHashTable *reply = NULL;
231 GError *error = NULL;
234 DEBUG ("%s %d", G_STRFUNC, __LINE__);
236 v_reply = signon_auth_session_process_finish (self, res, &error);
238 cancelled = error != NULL &&
239 error->domain == G_IO_ERROR &&
240 error->code == G_IO_ERROR_CANCELLED;
242 /* Do not invoke the callback if the operation was cancelled */
243 if (cb_data->cb != NULL && !cancelled)
246 reply = signon_hash_table_from_variant (v_reply);
248 cb_data->cb (self, reply, error, cb_data->user_data);
250 g_hash_table_unref (reply);
252 g_variant_unref (v_reply);
254 g_slice_free (AuthSessionProcessCbData, cb_data);
255 g_clear_error (&error);
256 g_object_unref (res);
260 auth_session_object_quark ()
262 static GQuark quark = 0;
265 quark = g_quark_from_static_string ("auth_session_object_quark");
271 signon_auth_session_set_property (GObject *object,
276 SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
281 self->priv->identity = g_value_dup_object (value);
284 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
289 signon_auth_session_get_property (GObject *object,
294 SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
299 g_value_set_object (value, self->priv->identity);
302 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
307 signon_auth_session_init (SignonAuthSession *self)
309 self->priv = SIGNON_AUTH_SESSION_GET_PRIV (self);
310 self->priv->cancellable = g_cancellable_new ();
314 signon_auth_session_dispose (GObject *object)
316 g_return_if_fail (SIGNON_IS_AUTH_SESSION (object));
317 SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
318 SignonAuthSessionPrivate *priv = self->priv;
319 g_return_if_fail (priv != NULL);
321 if (priv->dispose_has_run)
324 if (priv->cancellable)
326 g_cancellable_cancel (priv->cancellable);
327 priv->cancellable = NULL;
332 g_signal_handler_disconnect (priv->proxy, priv->signal_state_changed);
333 g_signal_handler_disconnect (priv->proxy, priv->signal_unregistered);
334 g_object_unref (priv->proxy);
339 G_OBJECT_CLASS (signon_auth_session_parent_class)->dispose (object);
341 priv->dispose_has_run = TRUE;
345 signon_auth_session_finalize (GObject *object)
347 g_return_if_fail (SIGNON_IS_AUTH_SESSION(object));
349 SignonAuthSession *self = SIGNON_AUTH_SESSION(object);
350 SignonAuthSessionPrivate *priv = self->priv;
351 g_return_if_fail (priv != NULL);
353 g_free (priv->method_name);
354 g_object_unref (priv->identity);
356 G_OBJECT_CLASS (signon_auth_session_parent_class)->finalize (object);
360 signon_auth_session_class_init (SignonAuthSessionClass *klass)
362 GObjectClass *object_class = G_OBJECT_CLASS (klass);
365 object_class->set_property = signon_auth_session_set_property;
366 object_class->get_property = signon_auth_session_get_property;
368 pspec = g_param_spec_object ("identity",
370 "Identity Object construct parameter",
371 SIGNON_TYPE_IDENTITY,
372 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
373 g_object_class_install_property (object_class,
377 g_type_class_add_private (object_class, sizeof (SignonAuthSessionPrivate));
380 * SignonAuthSession::state-changed:
381 * @auth_session: the #SignonAuthSession
382 * @state: the current state of the #SignonAuthSession
383 * @message: the message associated with the state change
385 * Emitted when the state of the #SignonAuthSession changes.
387 auth_session_signals[STATE_CHANGED] =
388 g_signal_new ("state-changed",
389 G_TYPE_FROM_CLASS (klass),
390 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
394 _signon_marshal_VOID__INT_STRING,
399 object_class->dispose = signon_auth_session_dispose;
400 object_class->finalize = signon_auth_session_finalize;
404 * signon_auth_session_new:
405 * @parent: #SignonIdentity parent object.
406 * @method_name: the name of the authentication method to be used.
407 * @err: a pointer to a location which will contain the error, in case this
410 * Creates a new #SignonAuthSession, which can be used to authenticate using
411 * the specified method.
413 * Returns: a new #SignonAuthSession.
416 signon_auth_session_new (GObject *parent,
417 const gchar *method_name,
420 if (!SIGNON_IS_IDENTITY(parent))
423 signon_error_quark(),
424 SIGNON_ERROR_UNKNOWN,
425 "Parent object is wrong type");
428 SignonIdentity *identity = SIGNON_IDENTITY(parent);
430 DEBUG ("%s %d", G_STRFUNC, __LINE__);
432 SignonAuthSession *self = SIGNON_AUTH_SESSION(g_object_new (
433 SIGNON_TYPE_AUTH_SESSION,
434 "identity", identity,
436 g_return_val_if_fail (self != NULL, NULL);
438 if (!auth_session_priv_init(self, method_name, err))
441 g_warning ("%s returned error: %s", G_STRFUNC, (*err)->message);
443 g_object_unref (self);
451 * signon_auth_session_get_method:
452 * @self: the #SignonAuthSession.
454 * Get the current authentication method.
456 * Returns: the authentication method being used, or %NULL on failure.
459 signon_auth_session_get_method (SignonAuthSession *self)
461 g_return_val_if_fail (SIGNON_IS_AUTH_SESSION (self), NULL);
462 SignonAuthSessionPrivate *priv = self->priv;
464 g_return_val_if_fail (priv != NULL, NULL);
466 return priv->method_name;
470 * SignonAuthSessionQueryAvailableMechanismsCb:
471 * @self: the #SignonAuthSession.
472 * @mechanisms: (transfer full) (type GStrv): list of available mechanisms.
473 * @error: a #GError if an error occurred, %NULL otherwise.
474 * @user_data: the user data that was passed when installing this callback.
476 * Callback to be passed to signon_auth_session_query_available_mechanisms().
480 * signon_auth_session_query_available_mechanisms:
481 * @self: the #SignonAuthSession.
482 * @wanted_mechanisms: a %NULL-terminated list of mechanisms supported by the client.
483 * @cb: (scope async): a callback which will be called with the result.
484 * @user_data: user data to be passed to the callback.
486 * Queries the mechanisms available for this authentication session. the result
487 * will be the intersection between @wanted_mechanisms and the mechanisms
488 * supported by the authentication plugin.
491 signon_auth_session_query_available_mechanisms (SignonAuthSession *self,
492 const gchar **wanted_mechanisms,
493 SignonAuthSessionQueryAvailableMechanismsCb cb,
496 g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
497 SignonAuthSessionPrivate* priv = self->priv;
499 g_return_if_fail (priv != NULL);
501 AuthSessionQueryAvailableMechanismsCbData *cb_data = g_slice_new0 (AuthSessionQueryAvailableMechanismsCbData);
502 cb_data->self = self;
504 cb_data->user_data = user_data;
506 AuthSessionQueryAvailableMechanismsData *operation_data = g_slice_new0 (AuthSessionQueryAvailableMechanismsData);
507 operation_data->wanted_mechanisms = g_strdupv ((gchar **)wanted_mechanisms);
508 operation_data->cb_data = cb_data;
510 auth_session_check_remote_object(self);
511 _signon_object_call_when_ready (self,
512 auth_session_object_quark(),
513 auth_session_query_available_mechanisms_ready_cb,
518 * SignonAuthSessionProcessCb:
519 * @self: the #SignonAuthSession.
520 * @session_data: (transfer full) (element-type utf8 GValue): a dictionary with
522 * @error: a #GError if an error occurred, %NULL otherwise.
523 * @user_data: the user data that was passed when installing this callback.
525 * This callback is invoked when the authentication plugin delivers the result
526 * of the signon_auth_session_process() operation.
530 * signon_auth_session_process:
531 * @self: the #SignonAuthSession.
532 * @session_data: (transfer none) (element-type utf8 GValue): a dictionary of parameters.
533 * @mechanism: the authentication mechanism to be used.
534 * @cb: (scope async): a callback which will be called with the result.
535 * @user_data: user data to be passed to the callback.
537 * Performs one step of the authentication process. If the #SignonAuthSession
538 * object is bound to an existing identity, the identity properties such as
539 * username and password will be also passed to the authentication plugin, so
540 * there's no need to fill them into @session_data.
541 * @session_data can be used to add additional authentication parameters to the
542 * session, or to override the parameters otherwise taken from the identity.
544 * Deprecated: 1.8: Use signon_auth_session_process_async() instead.
547 signon_auth_session_process (SignonAuthSession *self,
548 const GHashTable *session_data,
549 const gchar* mechanism,
550 SignonAuthSessionProcessCb cb,
553 GVariant *v_session_data;
555 g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
556 DEBUG ("%s %d", G_STRFUNC, __LINE__);
558 AuthSessionProcessCbData *cb_data = g_slice_new0 (AuthSessionProcessCbData);
560 cb_data->user_data = user_data;
562 v_session_data = signon_hash_table_to_variant (session_data);
564 signon_auth_session_process_async (self, v_session_data, mechanism, NULL,
565 process_async_cb_wrapper, cb_data);
569 * signon_auth_session_process_async:
570 * @self: the #SignonAuthSession.
571 * @session_data: (transfer floating): a dictionary of parameters.
572 * @mechanism: the authentication mechanism to be used.
573 * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
574 * @callback: (scope async): a callback which will be called when the
575 * authentication reply is available.
576 * @user_data: user data to be passed to the callback.
578 * Performs one step of the authentication process. If the #SignonAuthSession
579 * object is bound to an existing identity, the identity properties such as
580 * username and password will be also passed to the authentication plugin, so
581 * there's no need to fill them into @session_data.
582 * @session_data can be used to add additional authentication parameters to the
583 * session, or to override the parameters otherwise taken from the identity.
588 signon_auth_session_process_async (SignonAuthSession *self,
589 GVariant *session_data,
590 const gchar *mechanism,
591 GCancellable *cancellable,
592 GAsyncReadyCallback callback,
595 SignonAuthSessionPrivate *priv;
596 AuthSessionProcessData *process_data;
597 GSimpleAsyncResult *res;
599 g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
602 g_return_if_fail (session_data != NULL);
604 res = g_simple_async_result_new ((GObject *)self, callback, user_data,
605 signon_auth_session_process_async);
606 g_simple_async_result_set_check_cancellable (res, cancellable);
608 process_data = g_slice_new0 (AuthSessionProcessData);
609 process_data->session_data = g_variant_ref_sink (session_data);
610 process_data->mechanism = g_strdup (mechanism);
611 process_data->cancellable = cancellable;
612 g_object_set_data_full ((GObject *)res, data_key_process, process_data,
613 (GDestroyNotify)auth_session_process_data_free);
617 auth_session_check_remote_object(self);
618 _signon_object_call_when_ready (self,
619 auth_session_object_quark(),
620 auth_session_process_ready_cb,
625 * signon_auth_session_process_finish:
626 * @self: the #SignonAuthSession.
627 * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to
628 * signon_auth_session_process_async().
629 * @error: return location for error, or %NULL.
631 * Collect the result of the signon_auth_session_process_async() operation.
633 * Returns: a #GVariant of type %G_VARIANT_TYPE_VARDICT containing the
634 * authentication reply.
639 signon_auth_session_process_finish (SignonAuthSession *self, GAsyncResult *res,
642 GSimpleAsyncResult *async_result;
645 g_return_val_if_fail (SIGNON_IS_AUTH_SESSION (self), NULL);
647 async_result = (GSimpleAsyncResult *)res;
648 if (g_simple_async_result_propagate_error (async_result, error))
651 reply = g_simple_async_result_get_op_res_gpointer (async_result);
652 return g_variant_ref (reply);
656 * signon_auth_session_cancel:
657 * @self: the #SignonAuthSession.
659 * Cancel the authentication session.
662 signon_auth_session_cancel (SignonAuthSession *self)
664 g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
665 SignonAuthSessionPrivate *priv = self->priv;
667 g_return_if_fail (priv != NULL);
669 auth_session_check_remote_object(self);
674 priv->canceled = TRUE;
675 _signon_object_call_when_ready (self,
676 auth_session_object_quark(),
677 auth_session_cancel_ready_cb,
682 auth_session_state_changed_cb (GDBusProxy *proxy,
687 g_return_if_fail (SIGNON_IS_AUTH_SESSION (user_data));
688 SignonAuthSession *self = SIGNON_AUTH_SESSION (user_data);
690 g_signal_emit ((GObject *)self,
691 auth_session_signals[STATE_CHANGED],
697 static void auth_session_remote_object_destroyed_cb (GDBusProxy *proxy,
700 g_return_if_fail (SIGNON_IS_AUTH_SESSION (user_data));
701 SignonAuthSession *self = SIGNON_AUTH_SESSION (user_data);
702 SignonAuthSessionPrivate *priv = self->priv;
703 g_return_if_fail (priv != NULL);
704 DEBUG ("remote object unregistered");
708 g_object_unref (priv->proxy);
713 * as remote object is destroyed only
714 * when the session core is destroyed,
715 * so there should not be any processes
719 priv->canceled = FALSE;
720 _signon_object_not_ready(self);
724 auth_session_priv_init (SignonAuthSession *self,
725 const gchar *method_name, GError **err)
727 g_return_val_if_fail (SIGNON_IS_AUTH_SESSION (self), FALSE);
728 SignonAuthSessionPrivate *priv = SIGNON_AUTH_SESSION_PRIV (self);
729 g_return_val_if_fail (priv, FALSE);
731 priv->method_name = g_strdup (method_name);
733 priv->registering = FALSE;
735 priv->canceled = FALSE;
740 auth_session_query_mechanisms_reply (GObject *object, GAsyncResult *res,
743 SsoAuthSession *proxy = SSO_AUTH_SESSION (object);
744 gchar **mechanisms = NULL;
745 GError *error = NULL;
746 AuthSessionQueryAvailableMechanismsCbData *cb_data =
747 (AuthSessionQueryAvailableMechanismsCbData *)userdata;
748 g_return_if_fail (cb_data != NULL);
750 sso_auth_session_call_query_available_mechanisms_finish (proxy,
754 SIGNON_RETURN_IF_CANCELLED (error);
755 (cb_data->cb) (cb_data->self, mechanisms, error, cb_data->user_data);
758 g_error_free (error);
760 g_slice_free (AuthSessionQueryAvailableMechanismsCbData, cb_data);
764 auth_session_query_available_mechanisms_ready_cb (gpointer object, const GError *error,
767 g_return_if_fail (SIGNON_IS_AUTH_SESSION (object));
768 SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
769 SignonAuthSessionPrivate *priv = self->priv;
770 g_return_if_fail (priv != NULL);
772 AuthSessionQueryAvailableMechanismsData *operation_data =
773 (AuthSessionQueryAvailableMechanismsData *)user_data;
774 g_return_if_fail (operation_data != NULL);
776 AuthSessionQueryAvailableMechanismsCbData *cb_data = operation_data->cb_data;
777 g_return_if_fail (cb_data != NULL);
782 (self, NULL, error, cb_data->user_data);
784 g_slice_free (AuthSessionQueryAvailableMechanismsCbData, cb_data);
788 g_return_if_fail (priv->proxy != NULL);
789 sso_auth_session_call_query_available_mechanisms (
791 (const char **)operation_data->wanted_mechanisms,
793 auth_session_query_mechanisms_reply,
797 auth_session_signals[STATE_CHANGED],
799 SIGNON_AUTH_SESSION_STATE_PROCESS_PENDING,
800 auth_session_process_pending_message);
803 g_strfreev (operation_data->wanted_mechanisms);
804 g_slice_free (AuthSessionQueryAvailableMechanismsData, operation_data);
808 auth_session_cancel_ready_cb (gpointer object, const GError *error, gpointer user_data)
810 g_return_if_fail (SIGNON_IS_AUTH_SESSION (object));
811 g_return_if_fail (user_data == NULL);
813 SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
814 SignonAuthSessionPrivate *priv = self->priv;
815 g_return_if_fail (priv != NULL);
819 //TODO: in general this function does not return any values,
820 // that is why I think it should not emit anything for this particular case
821 DEBUG("error during initialization");
823 else if (priv->proxy && priv->busy)
824 sso_auth_session_call_cancel_sync (priv->proxy,
829 priv->canceled = FALSE;
833 signon_auth_session_complete (SignonAuthSession *self,
835 GDBusConnection *connection,
836 const gchar *bus_name,
837 const gchar *object_path)
839 SignonAuthSessionPrivate *priv = self->priv;
840 g_return_if_fail (priv != NULL);
842 DEBUG ("%s %d", G_STRFUNC, __LINE__);
844 priv->registering = FALSE;
845 if (!g_strcmp0(object_path, "") || error)
848 DEBUG ("Error message is %s", error->message);
850 error = g_error_new (signon_error_quark(),
851 SIGNON_ERROR_RUNTIME,
852 "Cannot create remote AuthSession object");
856 GError *proxy_error = NULL;
859 sso_auth_session_proxy_new_sync (connection,
860 G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
865 if (G_UNLIKELY (proxy_error != NULL))
867 g_warning ("Failed to initialize AuthSession proxy: %s",
868 proxy_error->message);
869 g_clear_error (&proxy_error);
872 g_dbus_proxy_set_default_timeout ((GDBusProxy *)priv->proxy,
875 priv->signal_state_changed =
876 g_signal_connect (priv->proxy,
878 G_CALLBACK (auth_session_state_changed_cb),
881 priv->signal_unregistered =
882 g_signal_connect (priv->proxy,
884 G_CALLBACK (auth_session_remote_object_destroyed_cb),
888 DEBUG ("Object path received: %s", object_path);
889 _signon_object_ready (self, auth_session_object_quark (), error);
893 auth_session_check_remote_object(SignonAuthSession *self)
895 g_return_if_fail (self != NULL);
896 SignonAuthSessionPrivate *priv = self->priv;
897 g_return_if_fail (priv != NULL);
899 if (priv->proxy != NULL)
902 g_return_if_fail (priv->identity != NULL);
904 if (!priv->registering)
906 DEBUG ("%s %d", G_STRFUNC, __LINE__);
908 priv->registering = TRUE;
909 signon_identity_get_auth_session (priv->identity,
912 signon_auth_session_complete);