All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.imunity.vaadin.endpoint.common.LogoutView Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */

package io.imunity.vaadin.endpoint.common;

import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.AfterNavigationEvent;
import com.vaadin.flow.router.AfterNavigationObserver;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.server.VaadinServlet;

@Route(value = LogoutView.LOGOUT_URL)
class LogoutView extends Div implements AfterNavigationObserver
{
	public static final String LOGOUT_URL = "logout";
	public final VaadinWebLogoutHandler vaadinWebLogoutHandler;

	public LogoutView(VaadinWebLogoutHandler vaadinWebLogoutHandler)
	{
		this.vaadinWebLogoutHandler = vaadinWebLogoutHandler;
	}

	@Override
	public void afterNavigation(AfterNavigationEvent afterNavigationEvent)
	{
		UI.getCurrent().getPage().setLocation(
				VaadinServlet.getFrontendMapping()
		);
		vaadinWebLogoutHandler.logout();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy