/** * signon_identity_store_credentials_with_args: * @self: the #SignonIdentity. * @username: username. * @secret: secret. * @store_secret: whether signond should store the password. * @methods: (transfer none) (element-type utf8 GStrv): methods. * @caption: caption. * @realms: (transfer none) (type GStrv): realms. * @access_control_list: (transfer none) (type GStrv): access control list. * @type: the type of the identity. * @cb: (scope async): callback. * @user_data: user_data. * * Stores the given data into the identity. */ void signon_identity_store_credentials_with_args(SignonIdentity *self, const gchar *username, const gchar *secret, const gboolean store_secret, const GHashTable *methods, const gchar *caption, const gchar* const *realms, const gchar* const *access_control_list, SignonIdentityType type, SignonIdentityStoreCredentialsCb cb, gpointer user_data) { SignonIdentityInfo *info; g_return_if_fail (SIGNON_IS_IDENTITY (self)); info = signon_identity_info_new (); signon_identity_info_set_username (info, username); signon_identity_info_set_secret (info, secret, store_secret); signon_identity_info_set_methods (info, methods); signon_identity_info_set_caption (info, caption); signon_identity_info_set_realms (info, realms); signon_identity_info_set_access_control_list (info, access_control_list); signon_identity_info_set_identity_type (info, type); signon_identity_store_credentials_with_info (self, info, cb, user_data); signon_identity_info_free (info); }
static SignonIdentityInfo *create_standard_info() { g_debug("%s", G_STRFUNC); SignonIdentityInfo *info = signon_identity_info_new (); signon_identity_info_set_username (info, "James Bond"); signon_identity_info_set_secret (info, "007", TRUE); signon_identity_info_set_caption (info, "caption"); gchar *mechanisms[] = { "mechanism1", "mechanism2", "mechanism3", NULL }; signon_identity_info_set_method (info, "method1", (const gchar **)mechanisms); signon_identity_info_set_method (info, "method2", (const gchar **)mechanisms); signon_identity_info_set_method (info, "method3", (const gchar **)mechanisms); return info; }
static void uoa_set_account_password (TpAccount *tp_account, const gchar *password, gboolean remember, GSimpleAsyncResult *result) { AgAccountService *service; AgAuthData *auth_data; guint cred_id; UoaChangePasswordData *data; SignonIdentity *identity; DEBUG ("Store password for %s in signond", tp_account_get_path_suffix (tp_account)); service = uoa_password_common (tp_account, result, &auth_data); if (service == NULL) return; data = uoa_change_password_data_new (service, password, remember, result); cred_id = ag_auth_data_get_credentials_id (auth_data); if (cred_id == 0) { SignonIdentityInfo *info; const GHashTable *params; const gchar *username; const gchar *acl_all[] = { "*", NULL }; /* This is the first time we store password for this account. * First check if we have an 'username' param as this is more accurate * in the tp-idle case. */ params = tp_account_get_parameters (tp_account); username = tp_asv_get_string (params, "username"); if (username == NULL) username = tp_asv_get_string (params, "account"); identity = signon_identity_new (); info = signon_identity_info_new (); signon_identity_info_set_username (info, username); signon_identity_info_set_secret (info, password, remember); signon_identity_info_set_access_control_list (info, acl_all); /* Give identity and data ownership to the callback */ signon_identity_store_credentials_with_info (identity, info, uoa_initial_identity_store_cb, data); signon_identity_info_free (info); } else { /* There is already a password stored, query info to update it. * Give identity and data ownership to the callback */ identity = signon_identity_new_from_db (cred_id); signon_identity_query_info (identity, uoa_identity_query_info_cb, data); } g_object_unref (service); ag_auth_data_unref (auth_data); }