|
|
|
|
@ -8,6 +8,10 @@ import { OtpResult, OobResult } from "../../importers/lastpass/access/models";
@@ -8,6 +8,10 @@ import { OtpResult, OobResult } from "../../importers/lastpass/access/models";
|
|
|
|
|
import { Ui } from "../../importers/lastpass/access/ui"; |
|
|
|
|
|
|
|
|
|
import { LastPassMultifactorPromptComponent } from "./dialog"; |
|
|
|
|
import { LastPassMultifactorPromptVariant } from "./dialog/lastpass-multifactor-prompt.component"; |
|
|
|
|
|
|
|
|
|
type OtpDialogVariant = Extract<LastPassMultifactorPromptVariant, "otp" | "yubikey">; |
|
|
|
|
type OobDialogVariant = Extract<LastPassMultifactorPromptVariant, "oob">; |
|
|
|
|
|
|
|
|
|
@Injectable({ |
|
|
|
|
providedIn: "root", |
|
|
|
|
@ -17,18 +21,21 @@ export class LastPassDirectImportUIService implements Ui {
@@ -17,18 +21,21 @@ export class LastPassDirectImportUIService implements Ui {
|
|
|
|
|
|
|
|
|
|
constructor(private dialogService: DialogService) {} |
|
|
|
|
|
|
|
|
|
private async getOTPResult() { |
|
|
|
|
this.mfaDialogRef = LastPassMultifactorPromptComponent.open(this.dialogService); |
|
|
|
|
const passcode = await firstValueFrom(this.mfaDialogRef.closed); |
|
|
|
|
private async getOTPResult(variant: OtpDialogVariant) { |
|
|
|
|
const passcode = await this.openMFADialog(variant); |
|
|
|
|
return new OtpResult(passcode, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private async getOOBResult() { |
|
|
|
|
private async getOOBResult(variant: OobDialogVariant) { |
|
|
|
|
const passcode = await this.openMFADialog(variant); |
|
|
|
|
return new OobResult(false, passcode, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private openMFADialog(variant: LastPassMultifactorPromptVariant) { |
|
|
|
|
this.mfaDialogRef = LastPassMultifactorPromptComponent.open(this.dialogService, { |
|
|
|
|
isOOB: true, |
|
|
|
|
variant, |
|
|
|
|
}); |
|
|
|
|
const passcode = await firstValueFrom(this.mfaDialogRef.closed); |
|
|
|
|
return new OobResult(false, passcode, false); |
|
|
|
|
return firstValueFrom(this.mfaDialogRef.closed); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeMFADialog() { |
|
|
|
|
@ -36,24 +43,24 @@ export class LastPassDirectImportUIService implements Ui {
@@ -36,24 +43,24 @@ export class LastPassDirectImportUIService implements Ui {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async provideGoogleAuthPasscode() { |
|
|
|
|
return this.getOTPResult(); |
|
|
|
|
return this.getOTPResult("otp"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async provideMicrosoftAuthPasscode() { |
|
|
|
|
return this.getOTPResult(); |
|
|
|
|
return this.getOTPResult("otp"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async provideYubikeyPasscode() { |
|
|
|
|
return this.getOTPResult(); |
|
|
|
|
return this.getOTPResult("yubikey"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async approveLastPassAuth() { |
|
|
|
|
return this.getOOBResult(); |
|
|
|
|
return this.getOOBResult("oob"); |
|
|
|
|
} |
|
|
|
|
async approveDuo() { |
|
|
|
|
return this.getOOBResult(); |
|
|
|
|
return this.getOOBResult("oob"); |
|
|
|
|
} |
|
|
|
|
async approveSalesforceAuth() { |
|
|
|
|
return this.getOOBResult(); |
|
|
|
|
return this.getOOBResult("oob"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|