summaryrefslogtreecommitdiff
path: root/libsoup/soup-auth-manager.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2016-11-07 08:44:36 +0100
committerCarlos Garcia Campos <carlosgc@gnome.org>2016-11-15 12:41:20 +0100
commitc661c44a3689fbc2aa562cc81b9a884f29735694 (patch)
tree2c9e40b72d72b1e259caf17285d902777dca90b2 /libsoup/soup-auth-manager.c
parentbd93c273ea787df4f3fe03c9cf6c8e53d8fc5fc9 (diff)
downloadlibsoup-c661c44a3689fbc2aa562cc81b9a884f29735694.tar.gz
Add API to clear cached credentials from SoupAuthManager
In WebKit, we need to clear the cached credentials. It's mainly used by tests to ensure that auth tests are independent to each other. https://bugzilla.gnome.org/show_bug.cgi?id=774031
Diffstat (limited to 'libsoup/soup-auth-manager.c')
-rw-r--r--libsoup/soup-auth-manager.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libsoup/soup-auth-manager.c b/libsoup/soup-auth-manager.c
index 703d188f..4e1645c1 100644
--- a/libsoup/soup-auth-manager.c
+++ b/libsoup/soup-auth-manager.c
@@ -740,6 +740,27 @@ soup_auth_manager_use_auth (SoupAuthManager *manager,
g_mutex_unlock (&priv->lock);
}
+/**
+ * soup_auth_manager_clear_cached_credentials:
+ * @manager: a #SoupAuthManager
+ *
+ * Clear all credentials cached by @manager
+ *
+ * Since: 2.58
+ */
+void
+soup_auth_manager_clear_cached_credentials (SoupAuthManager *manager)
+{
+ SoupAuthManagerPrivate *priv;
+
+ g_return_if_fail (SOUP_IS_AUTH_MANAGER (manager));
+
+ priv = manager->priv;
+ g_mutex_lock (&priv->lock);
+ g_hash_table_remove_all (priv->auth_hosts);
+ g_mutex_unlock (&priv->lock);
+}
+
static void
soup_auth_manager_session_feature_init (SoupSessionFeatureInterface *feature_interface,
gpointer interface_data)