imixs / imixs-jsf-example

Imixs JEE Web Example Application
8 stars 9 forks source link

Logout not working #19

Closed sureshadapa closed 3 years ago

sureshadapa commented 7 years ago

LoginController and LogoutController missing in imixs-jsf-example

rsoika commented 7 years ago

You can take the class org.imixs.workflow.faces.util.LoginController - method doLogout()

http://www.imixs.org/doc/apidocs/org/imixs/workflow/faces/util/LoginController.html

The login and logout is completely transparent and part of the JAAS framework from Java Enterprise. To logout you simply need to invalidate the session:

        FacesContext context = FacesContext.getCurrentInstance();
        ExternalContext externalContext = context.getExternalContext();
        HttpSession session = (HttpSession) externalContext.getSession(false);
        session.invalidate();