From 61dc5fbe2878103777d286d50db07eaa3f701d81 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Fri, 23 Aug 2019 08:35:26 -0700 Subject: [PATCH] [ApiAuthorization] Disables pop-up logout by default * There is an issue in Edge that prevents it from working. * Can be enabled by setting 'popUpDisabled = false' in 'authorize.service.ts' --- .../ClientApp/src/api-authorization/authorize.service.ts | 4 ++++ .../src/components/api-authorization/AuthorizeService.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/authorize.service.ts b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/authorize.service.ts index ce9e28bfa3..cf6e33cfda 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/authorize.service.ts +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/api-authorization/authorize.service.ts @@ -121,6 +121,10 @@ export class AuthorizeService { public async signOut(state: any): Promise { try { + if (this.popUpDisabled) { + throw new Error('Popup disabled. Change \'authorize.service.ts:AuthorizeService.popupDisabled\' to false to enable it.'); + } + await this.ensureUserManagerInitialized(); await this.userManager.signoutPopup(this.createArguments()); this.userSubject.next(null); diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/AuthorizeService.js b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/AuthorizeService.js index 8987f3fa83..87cfa82e86 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/AuthorizeService.js +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/api-authorization/AuthorizeService.js @@ -98,6 +98,10 @@ export class AuthorizeService { async signOut(state) { await this.ensureUserManagerInitialized(); try { + if (this._popUpDisabled) { + throw new Error('Popup disabled. Change \'AuthorizeService.js:AuthorizeService._popupDisabled\' to false to enable it.') + } + await this.userManager.signoutPopup(this.createArguments()); this.updateState(undefined); return this.success(state);