Target page after vaadin session invalidation

In my use case I have to invalidate Vaadin Sessions. I also use Spring (Boot) Security.
When a vaadin session is invalidated the browser reloads the page and redirects to my “/home” view.
However I want the browser to redirect to “/login” instead.

vaadinSession.getSession().invalidate();

Is there some api where I can define the session invalidation url.

(Changing the spring security invalidation url did not affect the vaadin session invalidation url)

Hey Jonas,

Have you checked this documentation? There are also some answers there that might help you with this.
https://vaadin.com/docs/v14/flow/advanced/tutorial-application-lifecycle.html

Hi,

One solution is to redirect via javascript since the session is invalidated:

VaadinSession.getCurrent().getSession().invalidate();
UI.getCurrent().getPage().executeJs("window.location.href='logout.html'");

I found the solutions in the comments of
https://vaadin.com/docs/v14/flow/advanced/tutorial-application-lifecycle.html

I added the following code in the AppShell:

		serviceInitEvent.getSource().setSystemMessagesProvider(systemMessagesInfo -> {
			CustomizedSystemMessages customizedSystemMessages = new CustomizedSystemMessages();
			customizedSystemMessages.setSessionExpiredURL("/target-url");
			return customizedSystemMessages;
		});