/* * Copyright 2000-2016 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.testbench.elements; import com.vaadin.testbench.elementsbase.ServerClass; @ServerClass("com.vaadin.ui.Video") public class VideoElement extends AbstractMediaElement { } alue='d1520204ea3e55acdab5a0d6fb03154ffe50d538'/> Vaadin 6, 7, 8 is a Java framework for modern Java web applications: https://github.com/vaadin/frameworkwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/documentation/articles/HandlingLogout.asciidoc
blob: e83ef7705b3e89072a4d18225bae015723542ac0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[[handling-logout]]
Handling logout
---------------
What should happen the user wants to log out from a Vaadin application
depends on how the user is stored when the user logged in.

If the user information is stored in the `VaadinSession`, that session
should be closed using its `close()` method. If the information on the
other hand is stored in the `HttpSession` or `PortletSession`, then that
session should be invalidated using the `invalidate()` method in Vaadin's
`WrappedSession` that represents either underlying session type.

Aside from removing the user's information, the user should also be
redirected to a logout page to avoid keeping the UI open in the browser
after all server-side information about is has been removed.

[source,java]
....
private void logout() {
    // Close the VaadinServiceSession
    getUI().getSession().close();

    // Invalidate underlying session instead if login info is stored there
    // VaadinService.getCurrentRequest().getWrappedSession().invalidate();

    // Redirect to avoid keeping the removed UI open in the browser
    getUI().getPage().setLocation(getLogoutPageLocation());
}
....