809f820cd4
Commit 4cda61a1
added support for pre-authenticated logins in
oVirt environments. This feature prevents a user from having
to type their password twice (once to the oVirt management machine,
and then immediately again in the provisioned guest running gnome-shell).
That feature is currently oVirt specific, but a similar feature would
be useful in non-oVirt based virt farm environments.
Toward that end, this commit generalizes the various aspects of the
oVirt integration code, so that it can be reused in a subsequent
commit for adding single sign on support in vmware deployments, too.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1983
52 lines
1.7 KiB
JavaScript
52 lines
1.7 KiB
JavaScript
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
/* exported getOVirtCredentialsManager */
|
|
|
|
const Gio = imports.gi.Gio;
|
|
const Signals = imports.signals;
|
|
const Credential = imports.gdm.credentialManager;
|
|
|
|
var SERVICE_NAME = 'gdm-ovirtcred';
|
|
|
|
const OVirtCredentialsIface = `
|
|
<node>
|
|
<interface name="org.ovirt.vdsm.Credentials">
|
|
<signal name="UserAuthenticated">
|
|
<arg type="s" name="token"/>
|
|
</signal>
|
|
</interface>
|
|
</node>`;
|
|
|
|
const OVirtCredentialsInfo = Gio.DBusInterfaceInfo.new_for_xml(OVirtCredentialsIface);
|
|
|
|
let _oVirtCredentialsManager = null;
|
|
|
|
function OVirtCredentials() {
|
|
var self = new Gio.DBusProxy({ g_connection: Gio.DBus.system,
|
|
g_interface_name: OVirtCredentialsInfo.name,
|
|
g_interface_info: OVirtCredentialsInfo,
|
|
g_name: 'org.ovirt.vdsm.Credentials',
|
|
g_object_path: '/org/ovirt/vdsm/Credentials',
|
|
g_flags: Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES });
|
|
self.init(null);
|
|
return self;
|
|
}
|
|
|
|
var OVirtCredentialsManager = class OVirtCredentialsManager extends Credential.CredentialManager {
|
|
constructor() {
|
|
super(SERVICE_NAME);
|
|
this._credentials = new OVirtCredentials();
|
|
this._credentials.connectSignal('UserAuthenticated',
|
|
(proxy, sender, [token]) => {
|
|
this.token = token;
|
|
});
|
|
}
|
|
};
|
|
Signals.addSignalMethods(OVirtCredentialsManager.prototype);
|
|
|
|
function getOVirtCredentialsManager() {
|
|
if (!_oVirtCredentialsManager)
|
|
_oVirtCredentialsManager = new OVirtCredentialsManager();
|
|
|
|
return _oVirtCredentialsManager;
|
|
}
|