Reviewed by Jan Alonzo.
[GTK] Remove keyring optional features
https://bugs.webkit.org/show_bug.cgi?id=28173
Remove keyring support, we now do authentication storage through
libsoup. We depend on libsoup master now, will bump the dependency
when there's a new release.
* GNUmakefile.am:
* configure.ac:
WebKit/gtk:
2009-08-12 Xan Lopez <xlopez@igalia.com>
Reviewed by Jan Alonzo.
[GTK] Remove keyring optional features
https://bugs.webkit.org/show_bug.cgi?id=28173
Remove keyring support from our code and rely on libsoup to store
the authentication data if the user requests that support in their
application/library.
* webkit/webkitsoupauthdialog.c:
(response_callback):
(show_auth_dialog):
(session_authenticate):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@47129
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2009-08-12 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Jan Alonzo.
+
+ [GTK] Remove keyring optional features
+ https://bugs.webkit.org/show_bug.cgi?id=28173
+
+ Remove keyring support, we now do authentication storage through
+ libsoup. We depend on libsoup master now, will bump the dependency
+ when there's a new release.
+
+ * GNUmakefile.am:
+ * configure.ac:
+
2009-08-11 Drew Wilson <atwilson@google.com>
Reviewed by NOBODY (Build break).
2009-08-11 Drew Wilson <atwilson@google.com>
Reviewed by NOBODY (Build break).
$(GAIL_CFLAGS) \
$(GEOCLUE_CFLAGS) \
$(GLIB_CFLAGS) \
$(GAIL_CFLAGS) \
$(GEOCLUE_CFLAGS) \
$(GLIB_CFLAGS) \
- $(GNOMEKEYRING_CFLAGS) \
$(GSTREAMER_CFLAGS) \
$(GTK_CFLAGS) \
$(HILDON_CFLAGS) \
$(GSTREAMER_CFLAGS) \
$(GTK_CFLAGS) \
$(HILDON_CFLAGS) \
$(GAIL_LIBS) \
$(GEOCLUE_LIBS) \
$(GLIB_LIBS) \
$(GAIL_LIBS) \
$(GEOCLUE_LIBS) \
$(GLIB_LIBS) \
$(GSTREAMER_LIBS) \
$(GTK_LIBS) \
$(HILDON_LIBS) \
$(GSTREAMER_LIBS) \
$(GTK_LIBS) \
$(HILDON_LIBS) \
-I$(srcdir)/WebKit/gtk/webkit \
-I$(top_builddir)/WebKit/gtk/webkit
-I$(srcdir)/WebKit/gtk/webkit \
-I$(top_builddir)/WebKit/gtk/webkit
-if USE_GNOMEKEYRING
-webkitgtk_cppflags += \
- -DWTF_USE_GNOMEKEYRING=1
-endif
-
webkitgtk_cleanfiles += \
$(top_builddir)/WebKit/gtk/docs/version.xml \
$(top_builddir)/WebKit/gtk/docs/GNUmakefile \
webkitgtk_cleanfiles += \
$(top_builddir)/WebKit/gtk/docs/version.xml \
$(top_builddir)/WebKit/gtk/docs/GNUmakefile \
+2009-08-12 Xan Lopez <xlopez@igalia.com>
+
+ Reviewed by Jan Alonzo.
+
+ [GTK] Remove keyring optional features
+ https://bugs.webkit.org/show_bug.cgi?id=28173
+
+ Remove keyring support from our code and rely on libsoup to store
+ the authentication data if the user requests that support in their
+ application/library.
+
+ * webkit/webkitsoupauthdialog.c:
+ (response_callback):
+ (show_auth_dialog):
+ (session_authenticate):
+
2009-08-11 Benjamin Otte <otte@gnome.org>
Reviewed by Xan Lopez.
2009-08-11 Benjamin Otte <otte@gnome.org>
Reviewed by Xan Lopez.
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <libsoup/soup.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <libsoup/soup.h>
-#if USE(GNOMEKEYRING)
-#include <gnome-keyring.h>
-#endif
#include "webkitmarshal.h"
#include "webkitsoupauthdialog.h"
/**
* SECTION:webkitsoupauthdialog
#include "webkitmarshal.h"
#include "webkitsoupauthdialog.h"
/**
* SECTION:webkitsoupauthdialog
- * @short_description: A #SoupFeature to provide a simple
+ * @short_description: A #SoupSessionFeature to provide a simple
* authentication dialog for HTTP basic auth support.
*
* authentication dialog for HTTP basic auth support.
*
- * #WebKitSoupAuthDialog is a #SoupFeature that you can attach to your
- * #SoupSession to provide a simple authentication dialog, with
- * optional GNOME Keyring support, while handling HTTP basic auth. It
- * is built as a simple C-only module to ease reuse.
+ * #WebKitSoupAuthDialog is a #SoupSessionFeature that you can attach to your
+ * #SoupSession to provide a simple authentication dialog while
+ * handling HTTP basic auth. It is built as a simple C-only module
+ * to ease reuse.
*/
static void webkit_soup_auth_dialog_session_feature_init(SoupSessionFeatureInterface* feature_interface, gpointer interface_data);
*/
static void webkit_soup_auth_dialog_session_feature_init(SoupSessionFeatureInterface* feature_interface, gpointer interface_data);
SoupSessionFeature* manager;
GtkWidget* loginEntry;
GtkWidget* passwordEntry;
SoupSessionFeature* manager;
GtkWidget* loginEntry;
GtkWidget* passwordEntry;
char *username;
char *password;
} WebKitAuthData;
char *username;
char *password;
} WebKitAuthData;
g_slice_free(WebKitAuthData, authData);
}
g_slice_free(WebKitAuthData, authData);
}
-#if USE(GNOMEKEYRING)
-static void set_password_callback(GnomeKeyringResult result, guint32 val, gpointer user_data)
-{
- /* Dummy callback, gnome_keyring_set_network_password does not accept a NULL one */
-}
-
static void save_password_callback(SoupMessage* msg, WebKitAuthData* authData)
{
static void save_password_callback(SoupMessage* msg, WebKitAuthData* authData)
{
- /* Check only for Success status codes (2xx) */
- if (msg->status_code >= 200 && msg->status_code < 300) {
- SoupURI* uri = soup_message_get_uri(authData->msg);
- gnome_keyring_set_network_password(NULL,
- authData->username,
- soup_auth_get_realm(authData->auth),
- uri->host,
- NULL,
- uri->scheme,
- soup_auth_get_scheme_name(authData->auth),
- uri->port,
- authData->password,
- (GnomeKeyringOperationGetIntCallback)set_password_callback,
- NULL,
- NULL);
- }
+ /* Anything but 401 and 5xx means the password was accepted */
+ if (msg->status_code != 401 && msg->status_code < 500)
+ soup_auth_save_password(authData->auth, authData->username, authData->password);
+
free_authData(authData);
}
free_authData(authData);
}
static void response_callback(GtkDialog* dialog, gint response_id, WebKitAuthData* authData)
{
static void response_callback(GtkDialog* dialog, gint response_id, WebKitAuthData* authData)
{
- switch(response_id) {
- case GTK_RESPONSE_OK:
+ gboolean freeAuthData = TRUE;
+
+ if (response_id == GTK_RESPONSE_OK) {
authData->username = g_strdup(gtk_entry_get_text(GTK_ENTRY(authData->loginEntry)));
authData->password = g_strdup(gtk_entry_get_text(GTK_ENTRY(authData->passwordEntry)));
authData->username = g_strdup(gtk_entry_get_text(GTK_ENTRY(authData->loginEntry)));
authData->password = g_strdup(gtk_entry_get_text(GTK_ENTRY(authData->passwordEntry)));
soup_auth_authenticate(authData->auth, authData->username, authData->password);
soup_auth_authenticate(authData->auth, authData->username, authData->password);
-#if USE(GNOMEKEYRING)
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(authData->checkButton)))
+ if (authData->checkButton &&
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(authData->checkButton))) {
g_signal_connect(authData->msg, "got-headers", G_CALLBACK(save_password_callback), authData);
g_signal_connect(authData->msg, "got-headers", G_CALLBACK(save_password_callback), authData);
-#endif
- default:
- break;
+ freeAuthData = FALSE;
+ }
}
soup_session_unpause_message(authData->session, authData->msg);
}
soup_session_unpause_message(authData->session, authData->msg);
-#if !USE(GNOMEKEYRING)
- free_authData(authData);
-#endif
+ if (freeAuthData)
+ free_authData(authData);
gtk_widget_destroy(GTK_WIDGET(dialog));
}
static GtkWidget *
gtk_widget_destroy(GTK_WIDGET(dialog));
}
static GtkWidget *
-table_add_entry (GtkWidget* table,
- int row,
- const char* label_text,
- const char* value,
- gpointer user_data)
+table_add_entry(GtkWidget* table,
+ int row,
+ const char* label_text,
+ const char* value,
+ gpointer user_data)
{
GtkWidget* entry;
GtkWidget* label;
{
GtkWidget* entry;
GtkWidget* label;
+static gboolean session_can_save_passwords(SoupSession* session)
+{
+ return soup_session_get_feature(session, SOUP_TYPE_PASSWORD_MANAGER) != NULL;
+}
+
static void show_auth_dialog(WebKitAuthData* authData, const char* login, const char* password)
{
GtkWidget* toplevel;
static void show_auth_dialog(WebKitAuthData* authData, const char* login, const char* password)
{
GtkWidget* toplevel;
GtkWidget* messageLabel;
char* message;
SoupURI* uri;
GtkWidget* messageLabel;
char* message;
SoupURI* uri;
GtkWidget* rememberBox;
GtkWidget* checkButton;
GtkWidget* rememberBox;
GtkWidget* checkButton;
/* From GTK+ gtkmountoperation.c, modified and simplified. LGPL 2 license */
/* From GTK+ gtkmountoperation.c, modified and simplified. LGPL 2 license */
/* Set the dialog up with HIG properties */
gtk_dialog_set_has_separator(dialog, FALSE);
/* Set the dialog up with HIG properties */
gtk_dialog_set_has_separator(dialog, FALSE);
- gtk_container_set_border_width(GTK_CONTAINER (dialog), 5);
+ gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
gtk_box_set_spacing(GTK_BOX(dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
gtk_box_set_spacing(GTK_BOX(dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width(GTK_CONTAINER (dialog->action_area), 5);
+ gtk_container_set_border_width(GTK_CONTAINER(dialog->action_area), 5);
gtk_box_set_spacing(GTK_BOX(dialog->action_area), 6);
gtk_window_set_resizable(window, FALSE);
gtk_box_set_spacing(GTK_BOX(dialog->action_area), 6);
gtk_window_set_resizable(window, FALSE);
FALSE, FALSE, 0);
vbox = gtk_vbox_new(FALSE, 6);
FALSE, FALSE, 0);
vbox = gtk_vbox_new(FALSE, 6);
- gtk_box_pack_start(GTK_BOX (mainVBox), vbox, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(mainVBox), vbox, FALSE, FALSE, 0);
/* The table that holds the entries */
entryContainer = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
/* The table that holds the entries */
entryContainer = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
FALSE, FALSE, 0);
table = gtk_table_new(2, 2, FALSE);
FALSE, FALSE, 0);
table = gtk_table_new(2, 2, FALSE);
- gtk_table_set_col_spacings(GTK_TABLE (table), 12);
- gtk_table_set_row_spacings(GTK_TABLE (table), 6);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 12);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 6);
gtk_container_add(GTK_CONTAINER(entryContainer), table);
authData->loginEntry = table_add_entry(table, 0, _("Username:"),
gtk_container_add(GTK_CONTAINER(entryContainer), table);
authData->loginEntry = table_add_entry(table, 0, _("Username:"),
gtk_entry_set_visibility(GTK_ENTRY(authData->passwordEntry), FALSE);
gtk_entry_set_visibility(GTK_ENTRY(authData->passwordEntry), FALSE);
-#if USE(GNOMEKEYRING)
- rememberBox = gtk_vbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (vbox), rememberBox,
- FALSE, FALSE, 0);
-
- checkButton = gtk_check_button_new_with_mnemonic(_("_Remember password"));
- if (login && password)
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkButton), TRUE);
- gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(checkButton))), TRUE);
- gtk_box_pack_start (GTK_BOX (rememberBox), checkButton, FALSE, FALSE, 0);
- authData->checkButton = checkButton;
-#endif
+ if (session_can_save_passwords(authData->session)) {
+ rememberBox = gtk_vbox_new(FALSE, 6);
+ gtk_box_pack_start(GTK_BOX(vbox), rememberBox,
+ FALSE, FALSE, 0);
+ checkButton = gtk_check_button_new_with_mnemonic(_("_Remember password"));
+ if (login && password)
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkButton), TRUE);
+ gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(checkButton))), TRUE);
+ gtk_box_pack_start(GTK_BOX(rememberBox), checkButton, FALSE, FALSE, 0);
+ authData->checkButton = checkButton;
+ }
g_signal_connect(dialog, "response", G_CALLBACK(response_callback), authData);
gtk_widget_show_all(widget);
}
g_signal_connect(dialog, "response", G_CALLBACK(response_callback), authData);
gtk_widget_show_all(widget);
}
-#if USE(GNOMEKEYRING)
-static void find_password_callback(GnomeKeyringResult result, GList* list, WebKitAuthData* authData)
-{
- GList* p;
- const char* login = NULL;
- const char* password = NULL;
-
- for (p = list; p; p = p->next) {
- /* FIXME: support multiple logins/passwords ? */
- GnomeKeyringNetworkPasswordData* data = (GnomeKeyringNetworkPasswordData*)p->data;
- login = data->user;
- password = data->password;
- break;
- }
-
- show_auth_dialog(authData, login, password);
-}
-#endif
-
static void session_authenticate(SoupSession* session, SoupMessage* msg, SoupAuth* auth, gboolean retrying, gpointer user_data)
{
SoupURI* uri;
WebKitAuthData* authData;
SoupSessionFeature* manager = (SoupSessionFeature*)user_data;
static void session_authenticate(SoupSession* session, SoupMessage* msg, SoupAuth* auth, gboolean retrying, gpointer user_data)
{
SoupURI* uri;
WebKitAuthData* authData;
SoupSessionFeature* manager = (SoupSessionFeature*)user_data;
+ GSList* users;
+ const char *login, *password;
soup_session_pause_message(session, msg);
/* We need to make sure the message sticks around when pausing it */
g_object_ref(msg);
uri = soup_message_get_uri(msg);
soup_session_pause_message(session, msg);
/* We need to make sure the message sticks around when pausing it */
g_object_ref(msg);
uri = soup_message_get_uri(msg);
- authData = g_slice_new(WebKitAuthData);
+ authData = g_slice_new0(WebKitAuthData);
authData->msg = msg;
authData->auth = auth;
authData->session = session;
authData->manager = manager;
authData->msg = msg;
authData->auth = auth;
authData->session = session;
authData->manager = manager;
- /*
- * If we have gnome-keyring let's try to find the password first in the ring.
- * Otherwise just show the dialog straight away
- */
-#if USE(GNOMEKEYRING)
- gnome_keyring_find_network_password(NULL,
- soup_auth_get_realm(auth),
- uri->host,
- NULL,
- uri->scheme,
- soup_auth_get_scheme_name(auth),
- uri->port,
- (GnomeKeyringOperationGetListCallback)find_password_callback,
- authData,
- NULL);
-#else
- show_auth_dialog(authData, NULL, NULL);
-#endif
+ login = password = NULL;
+
+ users = soup_auth_get_saved_users(auth);
+ if (users) {
+ login = users->data;
+ password = soup_auth_get_saved_password(auth, login);
+ soup_auth_free_saved_users(auth, users);
+ }
+
+ show_auth_dialog(authData, login, password);
}
static void attach(SoupSessionFeature* manager, SoupSession* session)
}
static void attach(SoupSessionFeature* manager, SoupSession* session)
LIBXSLT_REQUIRED_VERSION=1.1.7
SQLITE_REQUIRED_VERSION=3.0
GSTREAMER_REQUIRED_VERSION=0.10
LIBXSLT_REQUIRED_VERSION=1.1.7
SQLITE_REQUIRED_VERSION=3.0
GSTREAMER_REQUIRED_VERSION=0.10
-GNOME_KEYRING_REQUIRED_VERSION=2.26.0
ENCHANT_REQUIRED_VERSION=0.22
GAIL_REQUIRED_VERSION=1.8
ENCHANT_REQUIRED_VERSION=0.22
GAIL_REQUIRED_VERSION=1.8
[],[enable_geolocation="no"])
AC_MSG_RESULT([$enable_geolocation])
[],[enable_geolocation="no"])
AC_MSG_RESULT([$enable_geolocation])
-# check whether to enable gnomekeyring support
-AC_MSG_CHECKING([whether to enable gnomekeyring support])
-AC_ARG_ENABLE(gnomekeyring,
- AC_HELP_STRING([--enable-gnomekeyring],
- [enable support for gnomekeyring [default=no]]),
- [],[enable_gnomekeyring="no"])
-AC_MSG_RESULT([$enable_gnomekeyring])
-
# check whether to enable SVG support
AC_MSG_CHECKING([whether to enable SVG support])
AC_ARG_ENABLE(svg,
# check whether to enable SVG support
AC_MSG_CHECKING([whether to enable SVG support])
AC_ARG_ENABLE(svg,
AC_SUBST([LIBSOUP_CFLAGS])
AC_SUBST([LIBSOUP_LIBS])
AC_SUBST([LIBSOUP_CFLAGS])
AC_SUBST([LIBSOUP_LIBS])
-if test "$enable_gnomekeyring" = "yes"; then
- PKG_CHECK_MODULES([GNOMEKEYRING],
- [gnome-keyring-1 >= $GNOME_KEYRING_REQUIRED_VERSION])
- AC_SUBST([GNOMEKEYRING_CFLAGS])
- AC_SUBST([GNOMEKEYRING_LIBS])
-fi
-
# check if FreeType/FontConfig are available
if test "$with_font_backend" = "freetype"; then
if test "$with_target" = "directfb"; then
# check if FreeType/FontConfig are available
if test "$with_font_backend" = "freetype"; then
if test "$with_target" = "directfb"; then
AM_CONDITIONAL([USE_ICU_UNICODE], [test "$with_unicode_backend" = "icu"])
AM_CONDITIONAL([USE_GLIB_UNICODE], [test "$with_unicode_backend" = "glib"])
AM_CONDITIONAL([USE_ICU_UNICODE], [test "$with_unicode_backend" = "icu"])
AM_CONDITIONAL([USE_GLIB_UNICODE], [test "$with_unicode_backend" = "glib"])
-# Auth backend conditionals
-AM_CONDITIONAL([USE_GNOMEKEYRING], [test "$enable_gnomekeyring" = "yes"])
-
# Font backend conditionals
AM_CONDITIONAL([USE_FREETYPE], [test "$with_font_backend" = "freetype"])
AM_CONDITIONAL([USE_PANGO], [test "$with_font_backend" = "pango"])
# Font backend conditionals
AM_CONDITIONAL([USE_FREETYPE], [test "$with_font_backend" = "freetype"])
AM_CONDITIONAL([USE_PANGO], [test "$with_font_backend" = "pango"])
Dashboard support : $enable_dashboard_support
Filters support : $enable_filters
Geolocation support : $enable_geolocation
Dashboard support : $enable_dashboard_support
Filters support : $enable_filters
Geolocation support : $enable_geolocation
- GNOME Keyring support : $enable_gnomekeyring
JavaScript debugger/profiler support : $enable_javascript_debugger
HTML5 offline web applications support : $enable_offline_web_applications
HTML5 channel messaging support : $enable_channel_messaging
JavaScript debugger/profiler support : $enable_javascript_debugger
HTML5 offline web applications support : $enable_offline_web_applications
HTML5 channel messaging support : $enable_channel_messaging