diff --git a/lib/core/directives/logout.directive.spec.ts b/lib/core/directives/logout.directive.spec.ts index d7c1200740..12ba34dc88 100644 --- a/lib/core/directives/logout.directive.spec.ts +++ b/lib/core/directives/logout.directive.spec.ts @@ -87,17 +87,16 @@ describe('LogoutDirective', () => { expect(router.navigate).toHaveBeenCalledWith(['fake-base-logout']); }); - it('should redirect to redirectUriLogout on click if SSO auth', () => { + it('should never redirect if SSO auth, because the redirect is done by the js-api', () => { spyOn(router, 'navigate'); spyOn(authService, 'isOauth').and.returnValue(true); spyOn(authService, 'logout').and.returnValue(of(true)); - appConfig.config['oauth2.redirectUriLogout'] = 'fake-logout'; const button = fixture.nativeElement.querySelector('button'); button.click(); expect(authService.logout).toHaveBeenCalled(); - expect(router.navigate).toHaveBeenCalledWith(['fake-logout']); + expect(router.navigate).not.toHaveBeenCalled(); }); it('should redirect to login even on logout error', () => { diff --git a/lib/core/directives/logout.directive.ts b/lib/core/directives/logout.directive.ts index 0be926ddb9..83bfb3bdbf 100644 --- a/lib/core/directives/logout.directive.ts +++ b/lib/core/directives/logout.directive.ts @@ -52,11 +52,7 @@ export class LogoutDirective implements OnInit { getRedirectUri () { if (this.redirectUri === undefined ) { - if (this.auth.isOauth()) { - return this.appConfig.get('oauth2.redirectUriLogout'); - } else { - return this.appConfig.get('loginRoute', '/login'); - } + return this.appConfig.get('loginRoute', '/login'); } return this.redirectUri; } @@ -69,8 +65,8 @@ export class LogoutDirective implements OnInit { } redirectToUri() { - const redirectRoute = this.getRedirectUri(); - if (this.enableRedirect) { + if (this.enableRedirect && !this.auth.isOauth()) { + const redirectRoute = this.getRedirectUri(); this.router.navigate([redirectRoute]); } }