mirror of
https://github.com/bitwarden/jslib
synced 2025-12-19 17:53:48 +00:00
Tweak naming of twoFactorService interface
This commit is contained in:
@@ -6,6 +6,7 @@ import { TwoFactorProviderType } from "jslib-common/enums/twoFactorProviderType"
|
|||||||
import { AuthService } from "jslib-common/abstractions/auth.service";
|
import { AuthService } from "jslib-common/abstractions/auth.service";
|
||||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
import { TwoFactorService } from 'jslib-common/abstractions/twoFactor.service';
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class TwoFactorOptionsComponent implements OnInit {
|
export class TwoFactorOptionsComponent implements OnInit {
|
||||||
@@ -15,7 +16,7 @@ export class TwoFactorOptionsComponent implements OnInit {
|
|||||||
providers: any[] = [];
|
providers: any[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected authService: AuthService,
|
protected twoFactorService: TwoFactorService,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected i18nService: I18nService,
|
protected i18nService: I18nService,
|
||||||
protected platformUtilsService: PlatformUtilsService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
@@ -23,7 +24,7 @@ export class TwoFactorOptionsComponent implements OnInit {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.providers = this.authService.getSupportedTwoFactorProviders(this.win);
|
this.providers = this.twoFactorService.getSupportedProviders(this.win);
|
||||||
}
|
}
|
||||||
|
|
||||||
choose(p: any) {
|
choose(p: any) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { TwoFactorProviderType } from "../enums/twoFactorProviderType";
|
import { TwoFactorProviderType } from "../enums/twoFactorProviderType";
|
||||||
|
|
||||||
export abstract class TwoFactorService {
|
export abstract class TwoFactorService {
|
||||||
getSupportedTwoFactorProviders: (win: Window) => any[];
|
getSupportedProviders: (win: Window) => any[];
|
||||||
getDefaultProvider: (webAuthnSupported: boolean) => TwoFactorProviderType;
|
getDefaultProvider: (webAuthnSupported: boolean) => TwoFactorProviderType;
|
||||||
clearSelectedProvider: () => void;
|
clearSelectedProvider: () => void;
|
||||||
setProviders: (data: any) => void;
|
setProviders: (data: any) => void;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export class TwoFactorService implements TwoFactorServiceAbstraction {
|
|||||||
this.i18nService.t("yubiKeyDesc");
|
this.i18nService.t("yubiKeyDesc");
|
||||||
}
|
}
|
||||||
|
|
||||||
getSupportedTwoFactorProviders(win: Window): any[] {
|
getSupportedProviders(win: Window): any[] {
|
||||||
const providers: any[] = [];
|
const providers: any[] = [];
|
||||||
if (this.twoFactorProvidersData == null) {
|
if (this.twoFactorProvidersData == null) {
|
||||||
return providers;
|
return providers;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.se
|
|||||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||||
import { StateService } from "jslib-common/abstractions/state.service";
|
import { StateService } from "jslib-common/abstractions/state.service";
|
||||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||||
|
import { TwoFactorService } from "jslib-common/abstractions/twoFactor.service";
|
||||||
|
|
||||||
import { Response } from "../models/response";
|
import { Response } from "../models/response";
|
||||||
|
|
||||||
@@ -58,7 +59,8 @@ export class LoginCommand {
|
|||||||
protected policyService: PolicyService,
|
protected policyService: PolicyService,
|
||||||
clientId: string,
|
clientId: string,
|
||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
protected keyConnectorService: KeyConnectorService
|
protected keyConnectorService: KeyConnectorService,
|
||||||
|
protected twoFactorService: TwoFactorService
|
||||||
) {
|
) {
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
}
|
}
|
||||||
@@ -230,7 +232,7 @@ export class LoginCommand {
|
|||||||
}
|
}
|
||||||
if (response.twoFactor) {
|
if (response.twoFactor) {
|
||||||
let selectedProvider: any = null;
|
let selectedProvider: any = null;
|
||||||
const twoFactorProviders = this.authService.getSupportedTwoFactorProviders(null);
|
const twoFactorProviders = this.twoFactorService.getSupportedProviders(null);
|
||||||
if (twoFactorProviders.length === 0) {
|
if (twoFactorProviders.length === 0) {
|
||||||
return Response.badRequest("No providers available for this client.");
|
return Response.badRequest("No providers available for this client.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user