static void identity_info_cb(SignonIdentity *self, const SignonIdentityInfo *info, const GError *error, gpointer user_data) { if (error) { g_warning ("%s: Error: %s ", __func__, error->message); fail_if (info != NULL, "Error: %s ", error->message); g_main_loop_quit(main_loop); return; } g_warning ("No error"); SignonIdentityInfo **pattern_ptr = (SignonIdentityInfo **)user_data; SignonIdentityInfo *pattern = NULL; if (pattern_ptr) pattern = (*pattern_ptr); if (pattern == NULL) fail_unless (info == NULL, "The info must be NULL"); else { fail_unless (info != NULL, "The info must be non-null"); fail_unless (g_strcmp0 (signon_identity_info_get_username(info), signon_identity_info_get_username(pattern)) == 0, "The info has wrong username"); fail_unless (g_strcmp0 (signon_identity_info_get_caption(info), signon_identity_info_get_caption(pattern)) == 0, "The info has wrong caption"); GHashTable *methods = (GHashTable *)signon_identity_info_get_methods (info); gchar **mechs1 = g_hash_table_lookup (methods, "method1"); gchar **mechs2 = g_hash_table_lookup (methods, "method2"); gchar **mechs3 = g_hash_table_lookup (methods, "method3"); fail_unless (g_strv_length (mechs1) == 3); fail_unless (g_strv_length (mechs2) == 3); fail_unless (g_strv_length (mechs3) == 3); fail_unless (_contains(mechs1, "mechanism1")); fail_unless (_contains(mechs1, "mechanism2")); fail_unless (_contains(mechs1, "mechanism3")); fail_unless (_contains(mechs2, "mechanism1")); fail_unless (_contains(mechs2, "mechanism2")); fail_unless (_contains(mechs2, "mechanism3")); fail_unless (_contains(mechs3, "mechanism1")); fail_unless (_contains(mechs3, "mechanism2")); fail_unless (_contains(mechs3, "mechanism3")); } if (info) { signon_identity_info_free (pattern); *pattern_ptr = signon_identity_info_copy (info); } g_main_loop_quit(main_loop); }
static void identity_query_info_cb (SignonIdentity *identity, const SignonIdentityInfo *info, const GError *error, gpointer user_data) { AuthContext *ctx = user_data; if (error != NULL) { DEBUG ("Error querying info from identity: %s", error->message); auth_context_done (ctx); return; } ctx->username = g_strdup (signon_identity_info_get_username (info)); signon_auth_session_process_async (ctx->session, ag_auth_data_get_login_parameters (ctx->auth_data, NULL), ag_auth_data_get_mechanism (ctx->auth_data), NULL, session_process_cb, ctx); }