One way of keeping track of the state of a web application is by making use of the HTTP session. The currently authenticated user is part of the state of the application and can be stored in the HTTP session. In Vaadin applications, you can store values in the HTTP session by using the VaadinSession.setAttribute(String, Object) method. The first parameter is a custom identifier for the value which is specified using the second parameter. For example, we can store the number 777 in an attribute with the name number in the HTTP session as follows:
VaadinSession.getCurrent().setAttribute("number", 777);
You can remove the value from the session by passing null:
VaadinSession.getCurrent().setAttribute("number", null);