import { Injectable } from '@angular/core' ; import { Router , CanActivate } from '@angular/router' ; import { Logger } from '../logger.service' ; const log = new Logger ( 'AuthenticationGuard' ) ; @ Injectable ( ) export class AuthenticationGuard implements CanActivate { constructor ( private router ) { } canActivate ( ) { log . debug ( 'Not authenticated, redirecting...' ) ; this . router . navigate ( [ '/login' ] , { replaceUrl : true } ) ; return false ; } }