[MNT-21636] - added redirection when SSO is enabled for external link (#6099)

Co-authored-by: Vito Albano <vitoalbano@vitoalbano-mbp-0120.local>
This commit is contained in:
Vito 2020-09-08 15:51:28 +01:00 committed by GitHub
parent c57253ff54
commit 14c2408c69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,7 @@ import { AppConfigService } from '../app-config/app-config.service';
import { AuthGuardBase } from './auth-guard-base';
import { Observable } from 'rxjs';
import { MatDialog } from '@angular/material/dialog';
import { StorageService } from './storage.service';
@Injectable({
providedIn: 'root'
@ -33,12 +34,18 @@ export class AuthGuardEcm extends AuthGuardBase {
constructor(authenticationService: AuthenticationService,
router: Router,
appConfigService: AppConfigService,
dialog: MatDialog) {
dialog: MatDialog,
private storageService: StorageService) {
super(authenticationService, router, appConfigService, dialog);
}
checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
const redirectFragment = this.storageService.getItem('loginFragment');
if (this.authenticationService.isEcmLoggedIn() || this.withCredentials) {
if (redirectFragment) {
this.router.navigateByUrl(redirectFragment);
this.storageService.removeItem('loginFragment');
}
return true;
}
this.redirectToUrl('ECM', redirectUrl);