2020-01-03 16:31:15 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
|
|
/* exported CredentialManager */
|
|
|
|
|
2022-07-04 22:30:44 +00:00
|
|
|
const Signals = imports.misc.signals;
|
|
|
|
|
|
|
|
var CredentialManager = class CredentialManager extends Signals.EventEmitter {
|
2020-01-03 16:31:15 +00:00
|
|
|
constructor(service) {
|
2022-07-04 22:30:44 +00:00
|
|
|
super();
|
|
|
|
|
2020-01-03 16:31:15 +00:00
|
|
|
this._token = null;
|
|
|
|
this._service = service;
|
|
|
|
}
|
|
|
|
|
|
|
|
get token() {
|
|
|
|
return this._token;
|
|
|
|
}
|
|
|
|
|
|
|
|
set token(t) {
|
|
|
|
this._token = t;
|
|
|
|
if (this._token)
|
|
|
|
this.emit('user-authenticated', this._token);
|
|
|
|
}
|
|
|
|
|
|
|
|
get service() {
|
|
|
|
return this._service;
|
|
|
|
}
|
2020-10-28 19:26:18 +00:00
|
|
|
};
|