用户登出Logout or Timeout

package com.inetpsa.rvr.actions.general;

import org.apache.struts2.ServletActionContext;
import org.springframework.security.core.context.SecurityContextHolder;

public class LogoutAction extends ActionSupport {

    private static final long serialVersionUID = 4294917247923577891L;

    @Override
    public String input() throws Exception {
        // clear session
        ServletActionContext.getRequest().getSession(false).invalidate();
        // clear valorization
        SecurityContextHolder.getContext().setAuthentication(null);
        SecurityContextHolder.clearContext();
<span style="white-space:pre">	</span>// set menu false
        setHasMenu(Boolean.FALSE);

        return INPUT;
    }
}

你可能感兴趣的:(java)