1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * soup-password-manager.c: HTTP auth password manager interface
5 * Copyright (C) 2008 Red Hat, Inc.
12 #define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY
14 #include "soup-password-manager.h"
15 #include "soup-session-feature.h"
18 soup_password_manager_get_type (void)
20 static volatile gsize g_define_type_id__volatile = 0;
21 if (g_once_init_enter (&g_define_type_id__volatile))
23 GType g_define_type_id =
24 g_type_register_static_simple (G_TYPE_INTERFACE,
25 g_intern_static_string ("SoupPasswordManager"),
26 sizeof (SoupPasswordManagerInterface),
29 (GInstanceInitFunc)NULL,
31 g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT);
32 g_type_interface_add_prerequisite (g_define_type_id, SOUP_TYPE_SESSION_FEATURE);
33 g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
35 return g_define_type_id__volatile;
39 * soup_password_manager_get_passwords_async:
40 * @password_manager: the #SoupPasswordManager
41 * @msg: the #SoupMessage being authenticated
42 * @auth: the #SoupAuth being authenticated
43 * @retrying: whether or not this is a re-attempt to authenticate
44 * @async_context: (allow-none): the #GMainContext to invoke @callback in
45 * @cancellable: a #GCancellable, or %NULL
46 * @callback: callback to invoke after fetching passwords
47 * @user_data: data for @callback
49 * Asynchronously attempts to look up saved passwords for @auth/@msg
50 * and then calls @callback after updating @auth with the information.
51 * Also registers @auth with @password_manager so that if the caller
52 * calls soup_auth_save_password() on it, the password will be saved.
54 * #SoupPasswordManager does not actually use the @retrying flag itself;
55 * it just passes its value on to @callback.
57 * If @cancellable is cancelled, @callback will still be invoked.
62 soup_password_manager_get_passwords_async (SoupPasswordManager *password_manager,
66 GMainContext *async_context,
67 GCancellable *cancellable,
68 SoupPasswordManagerCallback callback,
71 SOUP_PASSWORD_MANAGER_GET_CLASS (password_manager)->
72 get_passwords_async (password_manager, msg, auth, retrying,
73 async_context, cancellable,
78 * soup_password_manager_get_passwords_sync:
79 * @password_manager: the #SoupPasswordManager
80 * @msg: the #SoupMessage being authenticated
81 * @auth: the #SoupAuth being authenticated
82 * @cancellable: a #GCancellable, or %NULL
84 * Synchronously attempts to look up saved passwords for @auth/@msg
85 * and updates @auth with the information. Also registers @auth with
86 * @password_manager so that if the caller calls
87 * soup_auth_save_password() on it, the password will be saved.
92 soup_password_manager_get_passwords_sync (SoupPasswordManager *password_manager,
95 GCancellable *cancellable)
97 SOUP_PASSWORD_MANAGER_GET_CLASS (password_manager)->
98 get_passwords_sync (password_manager, msg, auth, cancellable);