[gnome-shell/gnome-3-12] networkAgent: pass VPN hints to auth dialogs
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-12] networkAgent: pass VPN hints to auth dialogs
- Date: Tue, 30 Sep 2014 16:26:20 +0000 (UTC)
commit 36f051044c4653161ed844dff17df81a8d31fc13
Author: Dan Williams <dcbw redhat com>
Date: Mon Jul 7 16:44:44 2014 -0500
networkAgent: pass VPN hints to auth dialogs
Indicate to NetworkManager that the Shell's agent supports VPN
hints, and pass those hints to VPN auth dialogs that also indicate
that they support hints.
VPN plugins can request new secrets, for example if the previous
ones are incorrect (eg, user mis-typed the password) or some other
reason (next token code required to re-sync a hardware token).
The specific secret that the VPN wants, and a VPN-specific message,
are passed in hints from the plugin, to NetworkManager, to the
agent (GNOME Shell) and then to the auth dialog.
https://bugzilla.gnome.org/show_bug.cgi?id=737592
(cherry picked from commit 926de53c0cbd7ae59e89b386f8d02ae7ecde1b75)
js/ui/components/networkAgent.js | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index 181aa77..2b5bf35 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -373,6 +373,12 @@ const VPNRequestHandler = new Lang.Class({
argv.push('-i');
if (flags & NMClient.SecretAgentGetSecretsFlags.REQUEST_NEW)
argv.push('-r');
+ if (authHelper.supportsHints) {
+ for (let i = 0; i < hints.length; i++) {
+ argv.push('-t');
+ argv.push(hints[i]);
+ }
+ }
this._newStylePlugin = authHelper.externalUIMode;
@@ -591,7 +597,9 @@ const NetworkAgent = new Lang.Class({
Name: 'NetworkAgent',
_init: function() {
- this._native = new Shell.NetworkAgent({ identifier: 'org.gnome.Shell.NetworkAgent' });
+ this._native = new Shell.NetworkAgent({ identifier: 'org.gnome.Shell.NetworkAgent',
+ capabilities: NMClient.SecretAgentCapabilities.VPN_HINTS
+ });
this._dialogs = { };
this._vpnRequests = { };
@@ -691,16 +699,23 @@ const NetworkAgent = new Lang.Class({
let service = keyfile.get_string('VPN Connection', 'service');
let binary = keyfile.get_string('GNOME', 'auth-dialog');
let externalUIMode = false;
+ let hints = false;
+
try {
externalUIMode = keyfile.get_boolean('GNOME', 'supports-external-ui-mode');
} catch(e) { } // ignore errors if key does not exist
+
+ try {
+ hints = keyfile.get_boolean('GNOME', 'supports-hints');
+ } catch(e) { } // ignore errors if key does not exist
+
let path = binary;
if (!GLib.path_is_absolute(path)) {
path = GLib.build_filenamev([Config.LIBEXECDIR, path]);
}
if (GLib.file_test(path, GLib.FileTest.IS_EXECUTABLE))
- this._vpnBinaries[service] = { fileName: path, externalUIMode: externalUIMode };
+ this._vpnBinaries[service] = { fileName: path, externalUIMode: externalUIMode,
supportsHints: hints };
else
throw new Error('VPN plugin at %s is not executable'.format(path));
} catch(e) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]