Spring security logout support

As an introduction - very interesting framework, but the learning curve seems to be a vertical wall on this one.

The problem:
I used the Spring Security sample app to integrate Vaadin and Spring security. So far so good.
I am trying to log out of the app from within the app.

I have tried:

  • Anchor with target “/logout”.
  • Button with ClickListener and UI.getCurrent().navigate

In both cases the result is exactly the same:
I get the Vaadin development page saying that the route does not exist.
If I press F5 in the browser, or simply enter the URL again, I am logged out.

So, how can I make Vaadin load the actual logout page?
Surely I don’t need to inject “Window.location” JavaScript or something?

EDIT:
Seems like this works:
UI.getCurrent().getPage().executeJs("window.location.href='/logout'");
So ugly though.

This should be what you’re looking for:
UI.getCurrent().getPage().setLocation("/logout")

Yes, that works too, and actually this is how I do it now. But it’s exactly the same as doing the JS and it forces a page reload.

What would you like to happen? Logging out destroys the session and all Vaadin UIs that are part of it. So even if you call that logout endpoint using an AJAX request in the background, the page/UI will reload.

That does make sense, thinking about it. Either way, the setLocation is nicer than executing JS.