1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-08 03:23:50 +00:00

[PM-5156] [PM-5216] Duo v2 removal (#9513)

* remove library and update package and webpack

* update 2fa flow and remove feature flag

* update request and response models

* fix merge conflicts
This commit is contained in:
Ike
2024-06-25 11:09:45 -07:00
committed by GitHub
parent c35bbc522c
commit 41e1d91558
15 changed files with 36 additions and 627 deletions

View File

@@ -59,8 +59,8 @@ export class TwoFactorDuoComponent extends TwoFactorBaseComponent {
protected async enable() {
const request = await this.buildRequestModel(UpdateTwoFactorDuoRequest);
request.integrationKey = this.clientId;
request.secretKey = this.clientSecret;
request.clientId = this.clientId;
request.clientSecret = this.clientSecret;
request.host = this.host;
return super.enable(async () => {
@@ -78,8 +78,8 @@ export class TwoFactorDuoComponent extends TwoFactorBaseComponent {
}
private processResponse(response: TwoFactorDuoResponse) {
this.clientId = response.integrationKey;
this.clientSecret = response.secretKey;
this.clientId = response.clientId;
this.clientSecret = response.clientSecret;
this.host = response.host;
this.enabled = response.enabled;
}

View File

@@ -54,25 +54,14 @@
</ng-container>
<!-- Duo -->
<ng-container *ngIf="isDuoProvider">
<ng-container *ngIf="duoFrameless">
<p
bitTypography="body1"
*ngIf="selectedProviderType === providerType.OrganizationDuo"
class="tw-mb-0"
>
{{ "duoRequiredByOrgForAccount" | i18n }}
</p>
<p bitTypography="body1">{{ "launchDuoAndFollowStepsToFinishLoggingIn" | i18n }}</p>
</ng-container>
<ng-container *ngIf="!duoFrameless">
<div id="duo-frame" class="tw-mb-3">
<iframe
id="duo_iframe"
sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox"
></iframe>
</div>
</ng-container>
<p
bitTypography="body1"
*ngIf="selectedProviderType === providerType.OrganizationDuo"
class="tw-mb-0"
>
{{ "duoRequiredByOrgForAccount" | i18n }}
</p>
<p bitTypography="body1">{{ "launchDuoAndFollowStepsToFinishLoggingIn" | i18n }}</p>
</ng-container>
<bit-form-control *ngIf="selectedProviderType != null">
<bit-label>{{ "rememberMe" | i18n }}</bit-label>
@@ -107,7 +96,7 @@
buttonType="primary"
bitButton
bitFormButton
*ngIf="duoFrameless && isDuoProvider"
*ngIf="isDuoProvider"
>
<span> {{ "launchDuo" | i18n }} </span>
</button>

View File

@@ -1,17 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"
/>
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; child-src 'self' https://*.duosecurity.com https://*.duofederal.com; frame-src 'self' https://*.duosecurity.com https://*.duofederal.com;"
/>
<title>Bitwarden Duo Connector</title>
</head>
<body></body>
</html>

View File

@@ -1,18 +0,0 @@
html,
body {
margin: 0;
padding: 0;
}
body {
background: #efeff4 url("../images/loading.svg") 0 0 no-repeat;
}
iframe {
display: block;
width: 100%;
height: 400px;
border: none;
margin: 0;
padding: 0;
}

View File

@@ -1,47 +0,0 @@
import * as DuoWebSDK from "duo_web_sdk";
import { getQsParam } from "./common";
require("./duo.scss");
document.addEventListener("DOMContentLoaded", () => {
const frameElement = document.createElement("iframe");
frameElement.setAttribute("id", "duo_iframe");
setFrameHeight();
document.body.appendChild(frameElement);
const hostParam = getQsParam("host");
const requestParam = getQsParam("request");
const hostUrl = new URL("https://" + hostParam);
if (
!hostUrl.hostname.endsWith(".duosecurity.com") &&
!hostUrl.hostname.endsWith(".duofederal.com")
) {
return;
}
DuoWebSDK.init({
iframe: "duo_iframe",
host: hostUrl.hostname,
sig_request: requestParam,
submit_callback: (form: any) => {
invokeCSCode(form.elements.sig_response.value);
},
});
window.onresize = setFrameHeight;
function setFrameHeight() {
frameElement.style.height = window.innerHeight + "px";
}
});
function invokeCSCode(data: string) {
try {
(window as any).invokeCSharpAction(data);
} catch (err) {
// eslint-disable-next-line
console.log(err);
}
}