[gnome-boxes/wip/feborges/rdp: 9/14] rdp-display: Handle authentication requests



commit f665c1ded05110958d3afd9b48dac5e8df572ea0
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu Apr 26 10:46:17 2018 +0200

    rdp-display: Handle authentication requests
    
    By implementing Frdp.Display.authenticate we are able to chain up
    the passing of credentials from Boxes to Gtk-frdp to freerdp.

 src/rdp-display.vala | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/rdp-display.vala b/src/rdp-display.vala
index 973b9617..b9b64904 100644
--- a/src/rdp-display.vala
+++ b/src/rdp-display.vala
@@ -2,10 +2,20 @@
 using Gtk;
 using Frdp;
 
+private class Boxes.FrdpDisplay: Frdp.Display {
+    public override bool authenticate (out string username, out string password, out string domain) {
+        username = this.username;
+        password = this.password;
+        domain = null;
+
+        return true;
+    }
+}
+
 private class Boxes.RdpDisplay: Boxes.Display {
     public override string protocol { get { return "RDP"; } }
     public override string? uri { owned get { return @"rdp://$host:$port"; } }
-    private Frdp.Display display;
+    private FrdpDisplay display;
     private string host;
     private int port;
     private BoxConfig.SavedProperty[] saved_properties;
@@ -14,9 +24,9 @@
         saved_properties = {
             BoxConfig.SavedProperty () { name = "read-only", default_value = false }
         };
-        need_password = false;
-
-        display = new Frdp.Display ();
+        display = new FrdpDisplay ();
+        display.bind_property ("username", this, "username", BindingFlags.BIDIRECTIONAL);
+        display.bind_property ("password", this, "password", BindingFlags.BIDIRECTIONAL);
 
         display.rdp_connected.connect (() => {
             show (0);
@@ -26,6 +36,12 @@
             hide (0);
             access_finish ();
         });
+        display.rdp_needs_authentication.connect (() => {
+            need_username = true;
+            need_password = true;
+
+            display.close ();
+        });
     }
 
     public RdpDisplay (BoxConfig config, string host, int port) {


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