[NetworkManager-openconnect/master: 5/10] SAML webview: store cookies file in XDG_DATA_HOME
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-openconnect/master: 5/10] SAML webview: store cookies file in XDG_DATA_HOME
- Date: Sun, 24 Apr 2022 09:41:21 +0000 (UTC)
commit 2681c0d9a7f0953fb4a778a7dc4cc6a51c49969a
Author: Luca Boccassi <luca boccassi microsoft com>
Date: Wed Jul 29 12:49:39 2020 +0100
SAML webview: store cookies file in XDG_DATA_HOME
This should probably be changed to parse cookies and store them in
secret service, as the cookies are most likely used for SSO logins
on auth portals.
auth-dialog/main.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index e4fe0cc..6031c6c 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -738,9 +738,25 @@ static gboolean open_webview_idle(gpointer data)
struct WebviewContext *ctx = (struct WebviewContext *)data;
auth_ui_data *ui_data = _ui_data; /* FIXME global */
WebKitWebView *webView;
+ WebKitWebsiteDataManager *dm = NULL;
+ WebKitCookieManager *cm = NULL;
+ GString *storage = NULL;
// Create a browser instance
webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+
+ dm = webkit_web_view_get_website_data_manager(webView);
+ if (dm)
+ cm = webkit_website_data_manager_get_cookie_manager(dm);
+ if (cm)
+ storage = g_string_new (g_get_user_data_dir());
+ if (storage)
+ storage = g_string_append(storage, "/openconnect_saml_cookies");
+ if (storage) {
+ webkit_cookie_manager_set_persistent_storage(cm, storage->str,
WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT);
+ g_string_free(storage, TRUE);
+ }
+
g_signal_connect(webView, "load-changed", G_CALLBACK(load_changed_cb), ctx);
ctx->webview = webView;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]