简体   繁体   中英

logout handling in eclipse RAP application

In my RAP application I need to do some logout handling (forward do keycloak sso/logout). Where would be a good hook to do that?

org.eclipse.ui.application.WorkbenchAdvisor.postShutdown() is executed also if I refresh my browser window (F5), I don't want the session to logout on-refresh.
Rather if the session is expired or the browser window is closed.
Is there a hook for expired sessions or a session invalidation event?

Found UISessionListener.beforeDestroy() but it also is executed on browser-refresh:

RWT.getUISession().addUISessionListener(new UISessionListener() {
    @Override
    public void beforeDestroy(UISessionEvent event) {
        System.out.println("UISessionListener.beforeDestroy" + event);
    }
});

Code show that UISessionListener catch the event UISessionEvent that contains UISession. This object is bound to HttpSession, if you don't wont to expire just configure session to endless(better to make it quit long but not endless depends on amount of users using application).

HttpSession has expiration time by default (for example for apache tomcat it is 30m). But it is configurable. Session expired when not single "touch" of session (request) in such timeout occurs.

Also by default session will "survive" during tab close/open, since cookie saved on client side (again this behaviour configurable).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM