-
Notifications
You must be signed in to change notification settings - Fork 99
fix: configure 401 unauthorized response for endpoints #925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
validation tests failed with |
|
seems it requires a page refresh after the fix? If so, since the InvalidSessionMiddleWare is mostly about redirecting to login view. Should we just refresh the page in the server-side AccessDeniedHandler? then InvalidSessionMiddleWare is no longer needed? |
|
@haijian-vaadin the main concern in #924 is that Because with the session-based authentication Spring uses default session-based CSRF protection, when the session expires on the server we need to update the CSRF token on the client. In that case reloading the page is required, as it is currently the only way to obtain a fresh CSRF token. Note that an anonymous session expires on the server, there will be invalid CSRF exceptions for anonymous endpoints too, which triggers
Redirect was the default behaviour of Spring Security before this change. But this does not fit endpoint requests: redirecting in
I think it is still needed, or we need something else to cover a use case of handling expired CSRF and authentication on the client. Both sessions and JWT expire over time, so one API can cover both, I think. With stateless authentication, a non-reloading redirect on the client side to the login view should be a working way to deal with expired authentication, whereas with session-based CSRF you still have to reload the page. |
vaadin/spring#925 * fix: configure 401 unauthorized response for endpoints Fixes: vaadin/spring#924 * fix formatting * Add CSRF access denied handler for endpoints and tests * Don’t ignore obscure browser error * Fix SpringClassesSerializableTest * Fix stale PublicView element reference in test * Fix formatting, hope one day there will be a pre-commit hook * Handle StaleElementReferenceException * Fix open in SecurityIT * Remove waitForClientRouter Co-authored-by: ZheSun88 <zhe@vaadin.com>
vaadin/spring#925 * fix: configure 401 unauthorized response for endpoints Fixes: vaadin/spring#924 * fix formatting * Add CSRF access denied handler for endpoints and tests * Don’t ignore obscure browser error * Fix SpringClassesSerializableTest * Fix stale PublicView element reference in test * Fix formatting, hope one day there will be a pre-commit hook * Handle StaleElementReferenceException * Fix open in SecurityIT * Remove waitForClientRouter Co-authored-by: ZheSun88 <zhe@vaadin.com>
vaadin/spring#925 * fix: configure 401 unauthorized response for endpoints Fixes: vaadin/spring#924 * fix formatting * Add CSRF access denied handler for endpoints and tests * Don’t ignore obscure browser error * Fix SpringClassesSerializableTest * Fix stale PublicView element reference in test * Fix formatting, hope one day there will be a pre-commit hook * Handle StaleElementReferenceException * Fix open in SecurityIT * Remove waitForClientRouter Co-authored-by: ZheSun88 <zhe@vaadin.com>
vaadin/spring#925 * fix: configure 401 unauthorized response for endpoints Fixes: vaadin/spring#924 * fix formatting * Add CSRF access denied handler for endpoints and tests * Don’t ignore obscure browser error * Fix SpringClassesSerializableTest * Fix stale PublicView element reference in test * Fix formatting, hope one day there will be a pre-commit hook * Handle StaleElementReferenceException * Fix open in SecurityIT * Remove waitForClientRouter Co-authored-by: ZheSun88 <zhe@vaadin.com>
vaadin/spring#925 * fix: configure 401 unauthorized response for endpoints Fixes: vaadin/spring#924 * fix formatting * Add CSRF access denied handler for endpoints and tests * Don’t ignore obscure browser error * Fix SpringClassesSerializableTest * Fix stale PublicView element reference in test * Fix formatting, hope one day there will be a pre-commit hook * Handle StaleElementReferenceException * Fix open in SecurityIT * Remove waitForClientRouter Co-authored-by: ZheSun88 <zhe@vaadin.com>
vaadin/spring#925 * fix: configure 401 unauthorized response for endpoints Fixes: vaadin/spring#924 * fix formatting * Add CSRF access denied handler for endpoints and tests * Don’t ignore obscure browser error * Fix SpringClassesSerializableTest * Fix stale PublicView element reference in test * Fix formatting, hope one day there will be a pre-commit hook * Handle StaleElementReferenceException * Fix open in SecurityIT * Remove waitForClientRouter Co-authored-by: ZheSun88 <zhe@vaadin.com>
vaadin/spring#925 * fix: configure 401 unauthorized response for endpoints Fixes: vaadin/spring#924 * fix formatting * Add CSRF access denied handler for endpoints and tests * Don’t ignore obscure browser error * Fix SpringClassesSerializableTest * Fix stale PublicView element reference in test * Fix formatting, hope one day there will be a pre-commit hook * Handle StaleElementReferenceException * Fix open in SecurityIT * Remove waitForClientRouter Co-authored-by: ZheSun88 <zhe@vaadin.com>
Fixes #924