Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, Router } from '@angular/router';
// import { AuthenticationService } from './../../login/login.service';
import { environment } from '../../../environments/environment';
@Injectable()
export class EnableSSOGuard implements CanActivate {
constructor(private router: Router) {}

canActivate(route: ActivatedRouteSnapshot): boolean {
const enableSSO = environment.enablesso;
if (route.url.length === 0 || route.url[0].path === 'login') {
if (enableSSO) {
return true;
} else {
this.router.navigate(['loginWithoutSSO']);
}
} else {
if (route.url[0].path === 'loginWithoutSSO' && !enableSSO) {
return true;
} else {
this.router.navigate(['login']);
}
}
}
}