From 54d893a912e6755cdd317d35a24f07f6bd9d54cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Souto?= Date: Tue, 22 Aug 2023 12:22:26 +0200 Subject: [PATCH] fix problem in logoff when urlHandler option is present --- .../lib/logoff-revoke/logoff-revocation.service.spec.ts | 7 ++++++- .../src/lib/logoff-revoke/logoff-revocation.service.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/angular-auth-oidc-client/src/lib/logoff-revoke/logoff-revocation.service.spec.ts b/projects/angular-auth-oidc-client/src/lib/logoff-revoke/logoff-revocation.service.spec.ts index 30150fa9..9315be72 100644 --- a/projects/angular-auth-oidc-client/src/lib/logoff-revoke/logoff-revocation.service.spec.ts +++ b/projects/angular-auth-oidc-client/src/lib/logoff-revoke/logoff-revocation.service.spec.ts @@ -8,8 +8,8 @@ import { ResetAuthDataService } from '../flows/reset-auth-data.service'; import { CheckSessionService } from '../iframe/check-session.service'; import { LoggerService } from '../logging/logger.service'; import { StoragePersistenceService } from '../storage/storage-persistence.service'; -import { UrlService } from '../utils/url/url.service'; import { RedirectService } from '../utils/redirect/redirect.service'; +import { UrlService } from '../utils/url/url.service'; import { LogoffRevocationService } from './logoff-revocation.service'; describe('Logout and Revoke Service', () => { @@ -481,6 +481,10 @@ describe('Logout and Revoke Service', () => { spy(url); }; const redirectSpy = spyOn(redirectService, 'redirectTo'); + const resetAuthorizationDataSpy = spyOn( + resetAuthDataService, + 'resetAuthorizationData' + ); spyOn(checkSessionService, 'serverStateChanged').and.returnValue(false); const config = { configId: 'configId1' }; @@ -492,6 +496,7 @@ describe('Logout and Revoke Service', () => { result$.subscribe(() => { expect(redirectSpy).not.toHaveBeenCalled(); expect(spy).toHaveBeenCalledOnceWith('someValue'); + expect(resetAuthorizationDataSpy).toHaveBeenCalled(); }); })); diff --git a/projects/angular-auth-oidc-client/src/lib/logoff-revoke/logoff-revocation.service.ts b/projects/angular-auth-oidc-client/src/lib/logoff-revoke/logoff-revocation.service.ts index b465d93a..8c163e1c 100644 --- a/projects/angular-auth-oidc-client/src/lib/logoff-revoke/logoff-revocation.service.ts +++ b/projects/angular-auth-oidc-client/src/lib/logoff-revoke/logoff-revocation.service.ts @@ -69,6 +69,7 @@ export class LogoffRevocationService { `Custom UrlHandler found. Using this to handle logoff with url '${endSessionUrl}'` ); urlHandler(endSessionUrl); + this.resetAuthDataService.resetAuthorizationData(config, allConfigs); return of(null); }