How do I get the User's information after the login?

Hi Vaadin developers,

i want the server to return some unique data for a specific user. How do I get the identity of a user(can be visitor, user or admin)?

More detailedly,

  1. For some pages I want to check if the user has logged in and if not send them to login page
  2. For some pages I want to fetch data by the id or email of a user who has already logged in. How do I get his id / email?

I assume you are using Spring Boot there you have the SecurityContextHolder that contains the currently logged in user