-
Notifications
You must be signed in to change notification settings - Fork 176
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
NullPointerException in AuthenticationContext.logout() because VaadinServletResponse is null #20017
Comments
I can reproduce the issue, but only with |
When |
Hello @mcollovati, yes, I had set |
Thanks for the confirmation. |
Don't throw NullPointerException in case of null VaadinServletResponse in AuthenticationContext#logout. Fixes: #20017
Don't throw NullPointerException in case of null VaadinServletResponse in AuthenticationContext#logout. Tolerate null response better in case when running with @Push(transport = Transport.WEBSOCKET), or when response is null for some other reason. Makes logout also work in WEBSOCKET mode by automatically switching to WEBSOCKET_XHR for one additional request that executes logout. Fixes: #20017
Don't throw NullPointerException in case of null VaadinServletResponse in AuthenticationContext#logout. Tolerate null response better in case when running with @Push(transport = Transport.WEBSOCKET), or when response is null for some other reason. Makes logout also work in WEBSOCKET mode by automatically switching to WEBSOCKET_XHR for one additional request that executes logout. Fixes: #20017
Don't throw NullPointerException in case of null VaadinServletResponse in AuthenticationContext#logout. Tolerate null response better in case when running with @Push(transport = Transport.WEBSOCKET), or when response is null for some other reason. Makes logout also work in WEBSOCKET mode by automatically switching to WEBSOCKET_XHR for one additional request that executes logout. Fixes: #20017
Don't throw NullPointerException in case of null VaadinServletResponse in AuthenticationContext#logout. Tolerate null response better in case when running with @Push(transport = Transport.WEBSOCKET), or when response is null for some other reason. Makes logout also work in WEBSOCKET mode by automatically switching to WEBSOCKET_XHR for one additional request that executes logout. Fixes: #20017 Co-authored-by: Tomi Virtanen <[email protected]>
Don't throw NullPointerException in case of null VaadinServletResponse in AuthenticationContext#logout. Tolerate null response better in case when running with @Push(transport = Transport.WEBSOCKET), or when response is null for some other reason. Makes logout also work in WEBSOCKET mode by automatically switching to WEBSOCKET_XHR for one additional request that executes logout. Fixes: #20017 Co-authored-by: Tomi Virtanen <[email protected]>
Don't throw NullPointerException in case of null VaadinServletResponse in AuthenticationContext#logout. Tolerate null response better in case when running with @Push(transport = Transport.WEBSOCKET), or when response is null for some other reason. Makes logout also work in WEBSOCKET mode by automatically switching to WEBSOCKET_XHR for one additional request that executes logout. Fixes: #20017
This ticket/PR has been released with Vaadin 24.5.0.beta5 and is also targeting the upcoming stable 24.5.0 version. |
This ticket/PR has been released with Vaadin 24.3.19. |
This ticket/PR has been released with Vaadin 24.4.14. |
Description of the bug
I followed the example of enabling security using Spring Security. I added a logout button and used
AuthenticationContext.logout()
as described in the example.Instead of logging out, nothing happens because a
NullPointerException
is thrown hereflow/vaadin-spring/src/main/java/com/vaadin/flow/spring/security/AuthenticationContext.java
Lines 132 to 133 in 12633cd
The example when not using
AuthenticationContext
clearly does not try to useVaadinServletResponse
because it is a)null
and b) not used by the logout handler.example without
AuthenticationContext
stacktrace
Expected behavior
Successful logout, no NPE.
Minimal reproducible example
Add a logout button and use
AuthenticationContext.logout()
as described here.Versions
Hilla: 24.4.8
Flow: 24.4.8
Vaadin: 24.4.12
Copilot: 24.4.13
Copilot IDE Plugin: false
Java: Eclipse Adoptium 21.0.3
Java Hotswap: false
Frontend Hotswap: Disabled, using pre-built bundle
OS: amd64 Windows 11 10.0
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Spring Boot: 3.3.4
Spring Framework: 6.1.13
Spring Security: 6.3.3
The text was updated successfully, but these errors were encountered: