mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ACS-8961] Emit onLogout when redirected to login page (#10401)
* [ACS-8961] Emit onLogout when redirected to login page * [ACS-8961] empty commit [ci:force]
This commit is contained in:
parent
e967f20cb6
commit
dc7e5c2215
@ -171,6 +171,17 @@ describe('AuthGuardService', () => {
|
|||||||
expect(router.navigateByUrl).toHaveBeenCalledWith(router.parseUrl('/login?redirectUrl=some-url'));
|
expect(router.navigateByUrl).toHaveBeenCalledWith(router.parseUrl('/login?redirectUrl=some-url'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should emit onLogout if the user is NOT logged in and basic authentication is used', async () => {
|
||||||
|
spyOn(authService, 'isLoggedIn').and.returnValue(false);
|
||||||
|
spyOn(authService, 'isOauth').and.returnValue(false);
|
||||||
|
appConfigService.config.loginRoute = 'login';
|
||||||
|
spyOn(basicAlfrescoAuthService.onLogout, 'next');
|
||||||
|
|
||||||
|
await TestBed.runInInjectionContext(() => AuthGuard(route, state));
|
||||||
|
|
||||||
|
expect(basicAlfrescoAuthService.onLogout.next).toHaveBeenCalledWith(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('should set redirect url with query params', async () => {
|
it('should set redirect url with query params', async () => {
|
||||||
state.url = 'some-url;q=query';
|
state.url = 'some-url;q=query';
|
||||||
appConfigService.config.loginRoute = 'login';
|
appConfigService.config.loginRoute = 'login';
|
||||||
|
@ -67,12 +67,12 @@ export class AuthGuardService {
|
|||||||
provider: this.getProvider(),
|
provider: this.getProvider(),
|
||||||
url
|
url
|
||||||
});
|
});
|
||||||
|
this.basicAlfrescoAuthService.onLogout.next(true);
|
||||||
urlToRedirect = `${urlToRedirect}?redirectUrl=${url}`;
|
urlToRedirect = `${urlToRedirect}?redirectUrl=${url}`;
|
||||||
return this.navigate(urlToRedirect);
|
return this.navigate(urlToRedirect);
|
||||||
} else if (this.getOauthConfig().silentLogin && !this.oidcAuthenticationService.isPublicUrl()) {
|
} else if (this.getOauthConfig().silentLogin && !this.oidcAuthenticationService.isPublicUrl()) {
|
||||||
const shouldPerformSsoLogin = await new Promise((resolve) => {
|
const shouldPerformSsoLogin = await new Promise((resolve) => {
|
||||||
this.oidcAuthenticationService.shouldPerformSsoLogin$.subscribe(value => resolve(value));
|
this.oidcAuthenticationService.shouldPerformSsoLogin$.subscribe((value) => resolve(value));
|
||||||
});
|
});
|
||||||
if (shouldPerformSsoLogin) {
|
if (shouldPerformSsoLogin) {
|
||||||
this.oidcAuthenticationService.ssoLogin(url);
|
this.oidcAuthenticationService.ssoLogin(url);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user