From 0180d0cce5300d02931aaa2bee0a07aa44b8b923 Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Thu, 12 Aug 2021 16:12:31 -0400 Subject: [PATCH] Provide information to set webauthn allow in html template (#455) --- angular/src/components/two-factor.component.ts | 4 ++++ common/src/misc/webauthn_iframe.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/angular/src/components/two-factor.component.ts b/angular/src/components/two-factor.component.ts index e324c586d6..9369482d05 100644 --- a/angular/src/components/two-factor.component.ts +++ b/angular/src/components/two-factor.component.ts @@ -44,6 +44,10 @@ export class TwoFactorComponent implements OnInit, OnDestroy { onSuccessfulLogin: () => Promise; onSuccessfulLoginNavigate: () => Promise; + get webAuthnAllow(): string { + return `publickey-credentials-get ${this.environmentService.getWebVaultUrl()}`; + } + protected loginRoute = 'login'; protected successRoute = 'vault'; diff --git a/common/src/misc/webauthn_iframe.ts b/common/src/misc/webauthn_iframe.ts index 50870c5794..24aac0f8c4 100644 --- a/common/src/misc/webauthn_iframe.ts +++ b/common/src/misc/webauthn_iframe.ts @@ -1,6 +1,8 @@ import { I18nService } from '../abstractions/i18n.service'; import { PlatformUtilsService } from '../abstractions/platformUtils.service'; + import { IFrameComponent } from './iframe_component'; +import { Utils } from './utils'; export class WebAuthnIFrame extends IFrameComponent { constructor(win: Window, webVaultUrl: string, private webAuthnNewTab: boolean, @@ -20,7 +22,9 @@ export class WebAuthnIFrame extends IFrameComponent { this.platformUtilsService.launchUri(`${this.webVaultUrl}/webauthn-fallback-connector.html?${params}`); } else { super.initComponent(params); - this.iframe.allow = 'publickey-credentials-get ' + new URL(this.webVaultUrl).origin; + if (Utils.isNullOrWhitespace(this.iframe.allow)) { + this.iframe.allow = 'publickey-credentials-get ' + new URL(this.webVaultUrl).origin; + } } } }