I'm writing a web application with Spring boot, Spring web flow and thymeleaf. When the user session expires the csrf token in the registration form expires. How can I handle the session expiration showing a template file in Spring web flow?
Asked
Active
Viewed 752 times
1
-
Not the same question, but might have something relevant/helpful: https://stackoverflow.com/q/9909774/796761 – dbreaux Jan 14 '20 at 17:07
1 Answers
0
Session should be handled by Spring Security. You can redirect the current user to another page by adding configuration like this:
http.sessionManagement()
.expiredUrl("/sessionExpired.html")
.invalidSessionUrl("/invalidSession.html");
In Thymeleaf, you can use session
variable and add th:if
attribute to check if session exist or something similar:
${session.isEmpty()}
Check this answer https://stackoverflow.com/a/22120387/2230060

Aleksandar
- 636
- 1
- 7
- 24