static void identity_info_reply(GObject *object, GAsyncResult *res, gpointer userdata) { SsoIdentity *proxy = SSO_IDENTITY (object); GVariant *identity_data = NULL; DEBUG ("%d %s", __LINE__, __func__); GError *error = NULL; IdentityInfoCbData *cb_data = (IdentityInfoCbData *)userdata; g_return_if_fail (cb_data != NULL); g_return_if_fail (cb_data->self != NULL); g_return_if_fail (cb_data->self->priv != NULL); SignonIdentityPrivate *priv = cb_data->self->priv; sso_identity_call_get_info_finish (proxy, &identity_data, res, &error); SIGNON_RETURN_IF_CANCELLED (error); priv->identity_info = signon_identity_info_new_from_variant (identity_data); if (identity_data != NULL) g_variant_unref (identity_data); if (cb_data->cb) { (cb_data->cb) (cb_data->self, priv->identity_info, error, cb_data->user_data); } g_clear_error(&error); g_slice_free (IdentityInfoCbData, cb_data); priv->updated = TRUE; }
static void identity_store_credentials_reply (GObject *object, GAsyncResult *res, gpointer userdata) { IdentityStoreCredentialsCbData *cb_data = (IdentityStoreCredentialsCbData *)userdata; SsoIdentity *proxy = SSO_IDENTITY (object); guint id; GError *error = NULL; g_return_if_fail (cb_data != NULL); g_return_if_fail (cb_data->self != NULL); g_return_if_fail (cb_data->self->priv != NULL); SignonIdentityPrivate *priv = cb_data->self->priv; sso_identity_call_store_finish (proxy, &id, res, &error); SIGNON_RETURN_IF_CANCELLED (error); if (error == NULL) { g_return_if_fail (priv->identity_info == NULL); GSList *slist = priv->sessions; while (slist) { SignonAuthSession *session = SIGNON_AUTH_SESSION (priv->sessions->data); signon_auth_session_set_id (session, id); slist = g_slist_next (slist); } g_object_set (cb_data->self, "id", id, NULL); cb_data->self->priv->id = id; /* * if the previous state was REMOVED * then we need to reset it * */ priv->removed = FALSE; } if (cb_data->cb) { (cb_data->cb) (cb_data->self, id, error, cb_data->user_data); } g_clear_error(&error); g_slice_free (IdentityStoreCredentialsCbData, cb_data); }
static void identity_new_cb (GObject *object, GAsyncResult *res, gpointer userdata) { SignonIdentity *identity = (SignonIdentity*)userdata; SsoAuthService *proxy = SSO_AUTH_SERVICE (object); gchar *object_path; GError *error = NULL; g_return_if_fail (identity != NULL); DEBUG ("%s", G_STRFUNC); sso_auth_service_call_register_new_identity_finish (proxy, &object_path, res, &error); SIGNON_RETURN_IF_CANCELLED (error); identity_registered (identity, object_path, NULL, error); }
static void auth_session_process_reply (GObject *object, GAsyncResult *res, gpointer userdata) { SsoAuthSession *proxy = SSO_AUTH_SESSION (object); GVariant *session_data_variant; GHashTable *session_data = NULL; GError *error = NULL; AuthSessionProcessCbData *cb_data = (AuthSessionProcessCbData *)userdata; g_return_if_fail (cb_data != NULL); g_return_if_fail (cb_data->self != NULL); g_return_if_fail (cb_data->self->priv != NULL); sso_auth_session_call_process_finish (proxy, &session_data_variant, res, &error); SIGNON_RETURN_IF_CANCELLED (error); if (!error) { session_data = signon_hash_table_from_variant (session_data_variant); } /* Keep a reference on the SignonAuthSession, because the callback * code might unreference it, while we still need it. */ g_object_ref (cb_data->self); (cb_data->cb) (cb_data->self, session_data, error, cb_data->user_data); cb_data->self->priv->busy = FALSE; if (error) g_error_free (error); if (session_data != NULL) g_hash_table_unref (session_data); g_object_unref (cb_data->self); g_slice_free (AuthSessionProcessCbData, cb_data); }
static void auth_session_query_mechanisms_reply (GObject *object, GAsyncResult *res, gpointer userdata) { SsoAuthSession *proxy = SSO_AUTH_SESSION (object); gchar **mechanisms = NULL; GError *error = NULL; AuthSessionQueryAvailableMechanismsCbData *cb_data = (AuthSessionQueryAvailableMechanismsCbData *)userdata; g_return_if_fail (cb_data != NULL); sso_auth_session_call_query_available_mechanisms_finish (proxy, &mechanisms, res, &error); SIGNON_RETURN_IF_CANCELLED (error); (cb_data->cb) (cb_data->self, mechanisms, error, cb_data->user_data); if (error) g_error_free (error); g_slice_free (AuthSessionQueryAvailableMechanismsCbData, cb_data); }
static void identity_verify_reply (GObject *object, GAsyncResult *res, gpointer userdata) { SsoIdentity *proxy = SSO_IDENTITY (object); gboolean valid; GError *error = NULL; IdentityVerifyCbData *cb_data = (IdentityVerifyCbData *)userdata; g_return_if_fail (cb_data != NULL); g_return_if_fail (cb_data->self != NULL); sso_identity_call_verify_secret_finish (proxy, &valid, res, &error); SIGNON_RETURN_IF_CANCELLED (error); if (cb_data->cb) { (cb_data->cb) (cb_data->self, valid, error, cb_data->user_data); } g_clear_error(&error); g_slice_free (IdentityVerifyCbData, cb_data); }
static void auth_session_get_object_path_reply (GObject *object, GAsyncResult *res, gpointer userdata) { SsoAuthService *proxy = SSO_AUTH_SERVICE (object); gchar *object_path = NULL; GError *error = NULL; sso_auth_service_call_get_auth_session_object_path_finish (proxy, &object_path, res, &error); SIGNON_RETURN_IF_CANCELLED (error); g_return_if_fail (SIGNON_IS_AUTH_SESSION (userdata)); SignonAuthSession *self = SIGNON_AUTH_SESSION (userdata); SignonAuthSessionPrivate *priv = self->priv; g_return_if_fail (priv != NULL); priv->registering = FALSE; if (!g_strcmp0(object_path, "") || error) { if (error) DEBUG ("Error message is %s", error->message); else error = g_error_new (signon_error_quark(), SIGNON_ERROR_RUNTIME, "Cannot create remote AuthSession object"); } else { GDBusConnection *connection; const gchar *bus_name; GError *proxy_error = NULL; connection = g_dbus_proxy_get_connection ((GDBusProxy *)proxy); bus_name = g_dbus_proxy_get_name ((GDBusProxy *)proxy); priv->proxy = sso_auth_session_proxy_new_sync (connection, G_DBUS_PROXY_FLAGS_NONE, bus_name, object_path, priv->cancellable, &proxy_error); if (G_UNLIKELY (proxy_error != NULL)) { g_warning ("Failed to initialize AuthSession proxy: %s", proxy_error->message); g_clear_error (&proxy_error); } g_dbus_proxy_set_default_timeout ((GDBusProxy *)priv->proxy, G_MAXINT); priv->signal_state_changed = g_signal_connect (priv->proxy, "state-changed", G_CALLBACK (auth_session_state_changed_cb), self); priv->signal_unregistered = g_signal_connect (priv->proxy, "unregistered", G_CALLBACK (auth_session_remote_object_destroyed_cb), self); } DEBUG ("Object path received: %s", object_path); _signon_object_ready (self, auth_session_object_quark (), error); g_clear_error (&error); }