mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Should not redirect if is SilentLogin on (#5216)
* fix redirect * fix lint * remove false behaviour alrady tested in the new unit test * Update auth-guard-base.ts
This commit is contained in:
committed by
Denys Vuika
parent
3c1097fb84
commit
5578b7b851
@@ -64,12 +64,14 @@ export abstract class AuthGuardBase implements CanActivate, CanActivateChild {
|
||||
}
|
||||
|
||||
protected redirectToUrl(provider: string, url: string) {
|
||||
this.authenticationService.setRedirect({ provider, url });
|
||||
if (!this.isSilentLogin()) {
|
||||
this.authenticationService.setRedirect({ provider, url });
|
||||
|
||||
const pathToLogin = this.getLoginRoute();
|
||||
const urlToRedirect = `/${pathToLogin}?redirectUrl=${url}`;
|
||||
const pathToLogin = this.getLoginRoute();
|
||||
const urlToRedirect = `/${pathToLogin}?redirectUrl=${url}`;
|
||||
|
||||
this.router.navigateByUrl(urlToRedirect);
|
||||
this.router.navigateByUrl(urlToRedirect);
|
||||
}
|
||||
}
|
||||
|
||||
protected getLoginRoute(): string {
|
||||
@@ -91,4 +93,13 @@ export abstract class AuthGuardBase implements CanActivate, CanActivateChild {
|
||||
this.authenticationService.isOauth() && !!oauth && !oauth.silentLogin
|
||||
);
|
||||
}
|
||||
|
||||
protected isSilentLogin(): boolean {
|
||||
const oauth = this.appConfigService.get<OauthConfigModel>(
|
||||
AppConfigValues.OAUTHCONFIG,
|
||||
null
|
||||
);
|
||||
|
||||
return this.authenticationService.isOauth() && oauth && oauth.silentLogin;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user