From b2685d455b3d5ad32da8627c35dae053b0aee1a9 Mon Sep 17 00:00:00 2001 From: Matt Smith Date: Thu, 20 Aug 2020 14:30:22 -0500 Subject: [PATCH] Modifications made to support Browser Extension SSO (#605) * Update feature/sso jslib 261a200 -> 2e823ea (#589) * [SSO] Reset master password (#580) * Initial commit reset master password (sso) * Reverted order of two factor/reset password conditional * Added necessary resetMasterPassword flag for potential entry into RMP flow * Complete Revamp: Reverted Register // Deleted reset-master-password // updated sso/(settings)change password to use use super class // Adjust routing/messages // Created (accounts) change-password * Updated button -> Set Master Password * Refactored change password sub classes to use new submit pattern * Cleaned import statements * Update jslib (7fa5178 -> fe167be) * Update jslib fe167be - >34632e5 * Fixed sso base class import * merge master * Fixed missing semicolon // updated jslib to whats in feature/sso * Fixed two factor formatting * Added new change password component to app module * Updated component selector * updating jslib 34632e5 -> 2e823ea * Fixed lint warning in two-factor component Co-authored-by: Kyle Spearrin * Update jslib to 101c568 (#594) * Support for dynamic clientid (#595) * support third party sso clients * jslib update * update jslib * Modifications made for Browser Extension SSO * Brought web specific ssocomponent into module * Removed sso complete transition * Fixed remaining merge issues * Removed un-needed block of code. * Moved processing to sso-connector. * Removed unused import * Fixed curly braces.. * Linter fixes * Aligned verbiage for process message handler * Lintr fixes * Firefox can't handle closing the window this way. * Update sso.ts Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Kyle Spearrin Co-authored-by: Kyle Spearrin --- src/connectors/sso.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/connectors/sso.ts b/src/connectors/sso.ts index b5a172a97e..fffb922f23 100644 --- a/src/connectors/sso.ts +++ b/src/connectors/sso.ts @@ -4,7 +4,12 @@ require('./sso.scss'); document.addEventListener('DOMContentLoaded', (event) => { const code = getQsParam('code'); const state = getQsParam('state'); - window.location.href = window.location.origin + '/#/sso?code=' + code + '&state=' + state; + + if (state != null && state.endsWith(':clientId=browser')) { + initiateBrowserSso(code, state); + } else { + window.location.href = window.location.origin + '/#/sso?code=' + code + '&state=' + state; + } }); function getQsParam(name: string) { @@ -22,3 +27,7 @@ function getQsParam(name: string) { return decodeURIComponent(results[2].replace(/\+/g, ' ')); } + +function initiateBrowserSso(code: string, state: string) { + window.postMessage({ command: 'authResult', code: code, state: state }, '*'); +}