Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Passing parameters through URL using vaadin

Kshitij Arade
9 years ago Apr 16, 2012 2:23pm
Johannes Häyry
9 years ago Apr 18, 2012 12:18pm

If you want to do the authentication in your Vaadin application then you wouldn't really pass anything from application to another. Each of the applications could run in different sessions and you want to authenticate the user session. There is a LoginForm component that has a LoginListener or you could construct the layout with your own components, but anyhow you do it, you in a very basic case do something like in the following pseudo code:

onLogin(username, password) {
     User user = backend.getUser(username, securehash(password));
     if (user != null) {
          // Logged in
          getApplication().setUser(user);
     } else {
          getApplication().setUser(null);
          showNotification("Not logged in");
     }
}

Of course there are heavier ways to do it also Spring Security etc.

Kshitij Arade
9 years ago Apr 19, 2012 1:50pm