mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-18 02:41:15 +02:00
support for cipher login uris and match detection
This commit is contained in:
parent
ced108d1a6
commit
c27f5836bf
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit e3b3e444dbff7e4541fa5367ee26bc7ed4d73b26
|
Subproject commit ad4c81ed844f42e45467cd4467d993d30b1f8ce0
|
@ -129,7 +129,7 @@ export default class MainBackground {
|
|||||||
this.userService = new UserService(this.tokenService, this.storageService);
|
this.userService = new UserService(this.tokenService, this.storageService);
|
||||||
this.settingsService = new SettingsService(this.userService, this.storageService);
|
this.settingsService = new SettingsService(this.userService, this.storageService);
|
||||||
this.cipherService = new CipherService(this.cryptoService, this.userService, this.settingsService,
|
this.cipherService = new CipherService(this.cryptoService, this.userService, this.settingsService,
|
||||||
this.apiService, this.storageService, this.i18n2Service);
|
this.apiService, this.storageService, this.i18n2Service, this.platformUtilsService, this.utilsService);
|
||||||
this.folderService = new FolderService(this.cryptoService, this.userService,
|
this.folderService = new FolderService(this.cryptoService, this.userService,
|
||||||
() => this.i18nService.noneFolder, this.apiService, this.storageService, this.i18n2Service);
|
() => this.i18nService.noneFolder, this.apiService, this.storageService, this.i18n2Service);
|
||||||
this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService,
|
this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService,
|
||||||
@ -378,17 +378,12 @@ export default class MainBackground {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabDomain = this.platformUtilsService.getDomain(url);
|
|
||||||
if (tabDomain == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.actionSetBadgeBackgroundColor(chrome.browserAction);
|
this.actionSetBadgeBackgroundColor(chrome.browserAction);
|
||||||
this.actionSetBadgeBackgroundColor(this.sidebarAction);
|
this.actionSetBadgeBackgroundColor(this.sidebarAction);
|
||||||
|
|
||||||
this.menuOptionsLoaded = [];
|
this.menuOptionsLoaded = [];
|
||||||
try {
|
try {
|
||||||
const ciphers = await this.cipherService.getAllDecryptedForDomain(tabDomain);
|
const ciphers = await this.cipherService.getAllDecryptedForUrl(url);
|
||||||
ciphers.sort(this.cipherService.sortCiphersByLastUsedThenName);
|
ciphers.sort(this.cipherService.sortCiphersByLastUsedThenName);
|
||||||
|
|
||||||
if (contextMenuEnabled) {
|
if (contextMenuEnabled) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { CipherType } from 'jslib/enums';
|
import { CipherType } from 'jslib/enums';
|
||||||
|
|
||||||
import { CipherView } from 'jslib/models/view/cipherView';
|
import { CipherView } from 'jslib/models/view/cipherView';
|
||||||
|
import { LoginUriView } from 'jslib/models/view/loginUriView';
|
||||||
import { LoginView } from 'jslib/models/view/loginView';
|
import { LoginView } from 'jslib/models/view/loginView';
|
||||||
|
|
||||||
import { ConstantsService } from 'jslib/services/constants.service';
|
import { ConstantsService } from 'jslib/services/constants.service';
|
||||||
@ -181,7 +182,9 @@ export default class RuntimeBackground {
|
|||||||
this.main.loginsToAdd.splice(i, 1);
|
this.main.loginsToAdd.splice(i, 1);
|
||||||
|
|
||||||
const loginModel = new LoginView();
|
const loginModel = new LoginView();
|
||||||
loginModel.uri = loginInfo.uri;
|
const loginUri = new LoginUriView();
|
||||||
|
loginUri.uri = loginInfo.uri;
|
||||||
|
loginModel.uris = [loginUri];
|
||||||
loginModel.username = loginInfo.username;
|
loginModel.username = loginInfo.username;
|
||||||
loginModel.password = loginInfo.password;
|
loginModel.password = loginInfo.password;
|
||||||
const model = new CipherView();
|
const model = new CipherView();
|
||||||
@ -225,8 +228,7 @@ export default class RuntimeBackground {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ciphers = await this.cipherService.getAllDecryptedForDomain(loginDomain);
|
const ciphers = await this.cipherService.getAllDecryptedForUrl(loginInfo.url);
|
||||||
|
|
||||||
let match = false;
|
let match = false;
|
||||||
for (let i = 0; i < ciphers.length; i++) {
|
for (let i = 0; i < ciphers.length; i++) {
|
||||||
if (ciphers[i].login.username === loginInfo.username) {
|
if (ciphers[i].login.username === loginInfo.username) {
|
||||||
|
@ -27,22 +27,14 @@ export default class WebRequestBackground {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const domain = this.platformUtilsService.getDomain(details.url);
|
|
||||||
if (domain == null) {
|
|
||||||
if (callback) {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.pendingAuthRequests.push(details.requestId);
|
this.pendingAuthRequests.push(details.requestId);
|
||||||
|
|
||||||
if (this.isFirefox) {
|
if (this.isFirefox) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
await this.resolveAuthCredentials(domain, resolve, reject);
|
await this.resolveAuthCredentials(details.url, resolve, reject);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await this.resolveAuthCredentials(domain, callback, callback);
|
await this.resolveAuthCredentials(details.url, callback, callback);
|
||||||
}
|
}
|
||||||
}, { urls: ['http://*/*', 'https://*/*'] }, [this.isFirefox ? 'blocking' : 'asyncBlocking']);
|
}, { urls: ['http://*/*', 'https://*/*'] }, [this.isFirefox ? 'blocking' : 'asyncBlocking']);
|
||||||
|
|
||||||
@ -54,7 +46,7 @@ export default class WebRequestBackground {
|
|||||||
|
|
||||||
private async resolveAuthCredentials(domain: string, success: Function, error: Function) {
|
private async resolveAuthCredentials(domain: string, success: Function, error: Function) {
|
||||||
try {
|
try {
|
||||||
const ciphers = await this.cipherService.getAllDecryptedForDomain(domain);
|
const ciphers = await this.cipherService.getAllDecryptedForUrl(domain);
|
||||||
if (ciphers == null || ciphers.length !== 1) {
|
if (ciphers == null || ciphers.length !== 1) {
|
||||||
error();
|
error();
|
||||||
return;
|
return;
|
||||||
|
@ -133,7 +133,7 @@ export class CurrentController {
|
|||||||
CipherType.Identity,
|
CipherType.Identity,
|
||||||
];
|
];
|
||||||
|
|
||||||
const ciphers = await this.cipherService.getAllDecryptedForDomain(this.domain, otherTypes);
|
const ciphers = await this.cipherService.getAllDecryptedForUrl(this.url, otherTypes);
|
||||||
const loginCiphers: any = [];
|
const loginCiphers: any = [];
|
||||||
const cardCiphers: any = [];
|
const cardCiphers: any = [];
|
||||||
const identityCiphers: any = [];
|
const identityCiphers: any = [];
|
||||||
|
@ -216,12 +216,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabDomain = this.platformUtilsService.getDomain(tab.url);
|
const lastUsedCipher = await this.cipherService.getLastUsedForUrl(tab.url);
|
||||||
if (tabDomain == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lastUsedCipher = await this.cipherService.getLastUsedForDomain(tabDomain);
|
|
||||||
if (!lastUsedCipher) {
|
if (!lastUsedCipher) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user