X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=blueprints%2Fcommon%2Feliot-ui%2Ffrontend-src%2Fsrc%2Fapp%2F_helpers%2Fauth.guard.ts;fp=blueprints%2Fcommon%2Feliot-ui%2Ffrontend-src%2Fsrc%2Fapp%2F_helpers%2Fauth.guard.ts;h=0000000000000000000000000000000000000000;hb=434326c60fb0434bda587102b4746173fe425dea;hp=6ab08d2dddb9a701ba2395e6517b49df95d4f9e0;hpb=37827e492060182b32df67c2a538a29808fa5e17;p=eliot.git diff --git a/blueprints/common/eliot-ui/frontend-src/src/app/_helpers/auth.guard.ts b/blueprints/common/eliot-ui/frontend-src/src/app/_helpers/auth.guard.ts deleted file mode 100644 index 6ab08d2..0000000 --- a/blueprints/common/eliot-ui/frontend-src/src/app/_helpers/auth.guard.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree } from '@angular/router'; -import { Observable } from 'rxjs'; - -import { AuthenticationService } from './../_services/authentication.service'; - -@Injectable({ - providedIn: 'root' -}) -export class AuthGuard implements CanActivate { - - constructor( - private router: Router, - private authenticationService: AuthenticationService -) { } - - canActivate( - next: ActivatedRouteSnapshot, - state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { - const currentUser = this.authenticationService.currentUserValue; - if (currentUser) { - // authorised so return true - return true; - } - - // not logged in so redirect to login page - - this.router.navigate(['/login'], { queryParams: { returnUrl: state.url } }); - return false; - } - -}