[gnome-shell] networkAgent: Ask for wifi secrets in the hints paremeter



commit 4609cf191220e64dd4241fa4bca9f0df1bcb9b81
Author: Andrew Zaborowski <andrew zaborowski intel com>
Date:   Tue Sep 18 05:47:43 2018 +0200

    networkAgent: Ask for wifi secrets in the hints paremeter
    
    The `hints` and `settingName` parameters to the agent call may define
    the specific list of secrets NM actually needs from the user.  This
    seems to have been the intended use of these two parameters but only
    recently did NM with the IWD backend start to use this to request 802.1x
    secrets.  So if `hints` is provided, ask user for the specific secrets
    listed there and don't even look at what type of EAP method is in use.
    Only the three types of secrets actually in use by NM's IWD backend are
    supported for now -- they happen to be the same three that
    _get8021xSecrets() had already supported.

 js/ui/components/networkAgent.js | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index 998fcb792..6f7b81f94 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -198,6 +198,12 @@ var NetworkSecretDialog = new Lang.Class({
 
     _getWirelessSecrets(secrets, wirelessSetting) {
         let wirelessSecuritySetting = this._connection.get_setting_wireless_security();
+
+        if (this._settingName == '802-1x') {
+            this._get8021xSecrets(secrets);
+            return;
+        }
+
         switch (wirelessSecuritySetting.key_mgmt) {
         // First the easy ones
         case 'wpa-none':
@@ -231,6 +237,20 @@ var NetworkSecretDialog = new Lang.Class({
         let ieee8021xSetting = this._connection.get_setting_802_1x();
         let phase2method;
 
+        /* If hints were given we know exactly what we need to ask */
+        if (this._settingName == "802-1x" && this._hints.length) {
+            if (this._hints.includes('identity'))
+                secrets.push({ label: _("Username: "), key: 'identity',
+                               value: ieee8021xSetting.identity || '', password: false });
+            if (this._hints.includes('password'))
+                secrets.push({ label: _("Password: "), key: 'password',
+                               value: ieee8021xSetting.password || '', password: true });
+            if (this._hints.includes('private-key-password'))
+                secrets.push({ label: _("Private key password: "), key: 'private-key-password',
+                               value: ieee8021xSetting.private_key_password || '', password: true });
+            return;
+        }
+
         switch (ieee8021xSetting.get_eap_method(0)) {
         case 'md5':
         case 'leap':


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