1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 17:53:39 +00:00
This commit is contained in:
Oscar Hinton
2021-03-15 16:16:51 +01:00
committed by GitHub
parent f80e89465f
commit f20af0cd7c
15 changed files with 210 additions and 185 deletions

View File

@@ -57,14 +57,6 @@ export const TwoFactorProviders = {
sort: 4,
premium: false,
},
[TwoFactorProviderType.U2f]: {
type: TwoFactorProviderType.U2f,
name: null as string,
description: null as string,
priority: 4,
sort: 5,
premium: true,
},
[TwoFactorProviderType.Email]: {
type: TwoFactorProviderType.Email,
name: null as string,
@@ -73,6 +65,14 @@ export const TwoFactorProviders = {
sort: 6,
premium: false,
},
[TwoFactorProviderType.WebAuthn]: {
type: TwoFactorProviderType.WebAuthn,
name: null as string,
description: null as string,
priority: 4,
sort: 5,
premium: true,
},
};
export class AuthService implements AuthServiceAbstraction {
@@ -111,8 +111,8 @@ export class AuthService implements AuthServiceAbstraction {
TwoFactorProviders[TwoFactorProviderType.OrganizationDuo].description =
this.i18nService.t('duoOrganizationDesc');
TwoFactorProviders[TwoFactorProviderType.U2f].name = this.i18nService.t('u2fTitle');
TwoFactorProviders[TwoFactorProviderType.U2f].description = this.i18nService.t('u2fDesc');
TwoFactorProviders[TwoFactorProviderType.WebAuthn].name = this.i18nService.t('webAuthnTitle');
TwoFactorProviders[TwoFactorProviderType.WebAuthn].description = this.i18nService.t('webAuthnDesc');
TwoFactorProviders[TwoFactorProviderType.Yubikey].name = this.i18nService.t('yubiKeyTitle');
TwoFactorProviders[TwoFactorProviderType.Yubikey].description = this.i18nService.t('yubiKeyDesc');
@@ -196,8 +196,8 @@ export class AuthService implements AuthServiceAbstraction {
providers.push(TwoFactorProviders[TwoFactorProviderType.Duo]);
}
if (this.twoFactorProvidersData.has(TwoFactorProviderType.U2f) && this.platformUtilsService.supportsU2f(win)) {
providers.push(TwoFactorProviders[TwoFactorProviderType.U2f]);
if (this.twoFactorProvidersData.has(TwoFactorProviderType.WebAuthn) && this.platformUtilsService.supportsWebAuthn(win)) {
providers.push(TwoFactorProviders[TwoFactorProviderType.WebAuthn]);
}
if (this.twoFactorProvidersData.has(TwoFactorProviderType.Email)) {
@@ -207,7 +207,7 @@ export class AuthService implements AuthServiceAbstraction {
return providers;
}
getDefaultTwoFactorProvider(u2fSupported: boolean): TwoFactorProviderType {
getDefaultTwoFactorProvider(webAuthnSupported: boolean): TwoFactorProviderType {
if (this.twoFactorProvidersData == null) {
return null;
}
@@ -222,7 +222,7 @@ export class AuthService implements AuthServiceAbstraction {
this.twoFactorProvidersData.forEach((value, type) => {
const provider = (TwoFactorProviders as any)[type];
if (provider != null && provider.priority > providerPriority) {
if (type === TwoFactorProviderType.U2f && !u2fSupported) {
if (type === TwoFactorProviderType.WebAuthn && !webAuthnSupported) {
return;
}