We have an angular 2 application with a java spring boot backend. In the spring backend, we have set in the YAML config file a session-timeout of 1 hour (for testing purposes, I changed it to 1 minute). Once the session times out, the token is no long authenticated and the user needs to login again to resume/start the application.
Once the session times out, the angular app should redirect the user to the login page. It should do this regardless of user activity/idle state.
The thing I am stuck on is how to redirect the user in the angular 2 app to the login page once the session times out. I am wondering where and how to implement this? In a service class? In a user service class (I have a user service class that retrieves logged in user info from the spring backend). Does every component in the app need to check for session state?
Wondering best practices with angular 2.
Thanks!