smartcardManager: Add way to detect if user logged using token

If a user uses a token at login time and they have there system
configured to lock on smartcard removal we need to make sure they continue
to use the token at unlock time.

As a prerequisite for addressing that problem we need to know up front
if a user logged in with a token at all.

This commit adds the necessary api to detect that case.
This commit is contained in:
Ray Strode 2015-09-28 10:57:02 -04:00
parent bd816834c2
commit c3737f9546

View file

@ -5,6 +5,9 @@ import * as Signals from './signals.js';
import * as ObjectManager from './objectManager.js';
const SMARTCARD_SETTINGS_SCHEMA = 'org.gnome.settings-daemon.peripherals.smartcard';
const SMARTCARD_REMOVAL_ACTION = 'removal-action';
const SmartcardTokenIface = `
<node>
<interface name="org.gnome.SettingsDaemon.Smartcard.Token">
@ -38,6 +41,7 @@ class SmartcardManager extends Signals.EventEmitter {
knownInterfaces: [SmartcardTokenIface],
onLoaded: this._onLoaded.bind(this),
});
this._settings = new Gio.Settings({schema_id: SMARTCARD_SETTINGS_SCHEMA});
this._insertedTokens = {};
this._loginToken = null;
}
@ -117,5 +121,16 @@ class SmartcardManager extends Signals.EventEmitter {
return false;
return true;
},
loggedInWithToken() {
if (this._loginToken)
return true;
return false;
}
lockOnRemoval() {
return this._settings.get_string(SMARTCARD_REMOVAL_ACTION) === 'lock-screen';
}
}