'Vaadin >=v22: how does one properly logout of a session?
I was trying to locate some description or example how one properly logs out of a Vaadin application. In my application I want to provide a "logout" button or link that erases/clears the session so that one subsequently has to log in again. How does one do that?
Solution 1:[1]
// logout button
Button logoutButton = new Button("Logout", VaadinIcon.SIGN_OUT.create());
logoutButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY, ButtonVariant.LUMO_ERROR, ButtonVariant.LUMO_SMALL);
logoutButton.addClickListener(e -> {
VaadinSession.getCurrent().getSession().invalidate();
UI.getCurrent().getPage().reload();
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vikrant Thakur |
