mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1059391 - Add pref to disable caching of Sync authentication credentials. r=markh
This introduces a debugging pref, "services.sync.debug.ignoreCachedAuthCredentials". This flag allows testers to disable caching of authentication credentials to make debugging of expired and revoked credentials easier. This will help expedite any visble auth errors resulting from a expired or revoked FxA session token, e.g., from resetting or changing the FxA password. This pref is not set by default.
This commit is contained in:
parent
62f7c5af6c
commit
4faeb7fc5a
@ -163,7 +163,18 @@ AccountState.prototype = {
|
||||
},
|
||||
|
||||
getKeyPair: function(mustBeValidUntil) {
|
||||
if (this.keyPair && (this.keyPair.validUntil > mustBeValidUntil)) {
|
||||
// If the debugging pref to ignore cached authentication credentials is set for Sync,
|
||||
// then don't use any cached key pair, i.e., generate a new one and get it signed.
|
||||
// The purpose of this pref is to expedite any auth errors as the result of a
|
||||
// expired or revoked FxA session token, e.g., from resetting or changing the FxA
|
||||
// password.
|
||||
let ignoreCachedAuthCredentials = false;
|
||||
try {
|
||||
ignoreCachedAuthCredentials = Services.prefs.getBoolPref("services.sync.debug.ignoreCachedAuthCredentials");
|
||||
} catch(e) {
|
||||
// Pref doesn't exist
|
||||
}
|
||||
if (!ignoreCachedAuthCredentials && this.keyPair && (this.keyPair.validUntil > mustBeValidUntil)) {
|
||||
log.debug("getKeyPair: already have a keyPair");
|
||||
return this.resolve(this.keyPair.keyPair);
|
||||
}
|
||||
|
@ -475,6 +475,17 @@ this.BrowserIDManager.prototype = {
|
||||
* signed in?
|
||||
*/
|
||||
hasValidToken: function() {
|
||||
// If pref is set to ignore cached authentication credentials for debugging,
|
||||
// then return false to force the fetching of a new token.
|
||||
let ignoreCachedAuthCredentials = false;
|
||||
try {
|
||||
ignoreCachedAuthCredentials = Svc.Prefs.get("debug.ignoreCachedAuthCredentials");
|
||||
} catch(e) {
|
||||
// Pref doesn't exist
|
||||
}
|
||||
if (ignoreCachedAuthCredentials) {
|
||||
return false;
|
||||
}
|
||||
if (!this._token) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user