Working with Vaadin Session - beginner.

Hi everyone,

I’m trying to make a login system with Vaadin and I’d like to work with Vaadin Sessions to check for example the user is logged in or not - if not logged in navigate to home page and show a notification that says “You should be logged in…”. How can I check if a session is alive or not? Or Did I misunderstand something about sessions in Vaadin?

I’ve checked the Vaadin Documentations about it, but I didn’t understand it properly.

Could someone help me? Some code stuff would be very helpful.

Thanks for anything.


If you’re showing a Vaadin application, you will have a live session available. Typically you’d check logged in status by checking if a session property (like username) is present or not. If it’s not found, show the login view. When logging out, invalidate the session.