I have an angular app with .net core back-end. I am using windows active directory for user authorization/identification. Everything is working, but I have a feeling that the app is slow... I have confirmed that this is happening because because I am checking is user valid on each component load.
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> {
if (this.auth.isAuthenticated) {
return true;
} else {
return this.router.parseUrl('/notAuthorized');
}
});
"isAuthenticated" is a method which is calling a back-end and checking is user valid or not.
So, any suggestion about a best practice for handling this kind of situation?
Because of server call on each route, it is slowing down, you can store your AuthSession in session storage and check whether Session is present or not
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.