[gnome-builder] gui: restrict accepted auth mechanisms



commit dc8c5a405cf6cd556d14cda155001e427a90305a
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 5 10:42:50 2019 -0700

    gui: restrict accepted auth mechanisms
    
    We only need to support EXTERNAL here given our use-case.

 src/libide/gui/ide-worker-manager.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/libide/gui/ide-worker-manager.c b/src/libide/gui/ide-worker-manager.c
index 25aea415d..0d25670cd 100644
--- a/src/libide/gui/ide-worker-manager.c
+++ b/src/libide/gui/ide-worker-manager.c
@@ -47,6 +47,17 @@ G_DEFINE_TYPE (IdeWorkerManager, ide_worker_manager, G_TYPE_OBJECT)
 
 DZL_DEFINE_COUNTER (instances, "IdeWorkerManager", "Instances", "Number of IdeWorkerManager instances")
 
+static gboolean
+ide_worker_manager_allow_mechanism_cb (IdeWorkerManager  *self,
+                                       const gchar       *mechanism,
+                                       GDBusAuthObserver *auth_observer)
+{
+  g_assert (IDE_IS_WORKER_MANAGER (self));
+  g_assert (G_IS_DBUS_AUTH_OBSERVER (auth_observer));
+
+  return ide_str_equal0 ("EXTERNAL", mechanism);
+}
+
 static gboolean
 ide_worker_manager_authorize_authenticated_peer_cb (IdeWorkerManager  *self,
                                                     GIOStream         *stream,
@@ -141,6 +152,12 @@ ide_worker_manager_constructed (GObject *object)
 
   self->auth_observer = g_dbus_auth_observer_new ();
 
+  g_signal_connect_object (self->auth_observer,
+                           "allow-mechanism",
+                           G_CALLBACK (ide_worker_manager_allow_mechanism_cb),
+                           self,
+                           G_CONNECT_SWAPPED);
+
   g_signal_connect_object (self->auth_observer,
                            "authorize-authenticated-peer",
                            G_CALLBACK (ide_worker_manager_authorize_authenticated_peer_cb),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]