There is a form with POST method and csrf_token = '1'
(for brevity).
After the session timeout, I submit the form and get redirected to login page. After logging in, I can see the old token (in the request) and the new generated token ('2') in CsrfFilter
(in the debugger). Since these don't match, I get an InvalidCsrfTokenException
and then a 403 error.
How should Spring normally behave in this case?
I checked these posts:
- Getting 403 with CSRF token in spring security
- Session timeout leads to Access Denied in Spring MVC when CSRF integration with Spring Security
but they both look like workarounds. Is there no better option? Why wouldn't the Spring team include one of them as a default?