import { ActivatedRouteSnapshot , CanActivate } from '@angular/router' ; import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs' ; import { UserAuthService } from 'app/services/user-auth.service' ; @ Injectable ( { providedIn : 'root' } ) export class SSOGuard implements CanActivate { constructor ( private userAuthService ) { } canActivate ( route ) { const sso = route . queryParams [ 'sso' ] ; if ( ! this . userAuthService . isLoggedIn ( ) && sso === 'true' ) { this . userAuthService . redirectToLogin ( ) ; } return true ; } }