我已经尝试了所有可以想象的方法。在 Glassfish 中禁用 SSO。将 session.invalidate() 放入 jsp 页面并重定向。在 jsf 支持 bean 中做了 request.invalidate。我应该怎么办?谢谢。
编辑
这行得通。
private String email;
public ViewLines() {
}
@PostConstruct
public void onLoad() {
Principal principal = FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal();
email = principal.getName();
if (email != null) {
User user = userService.findUserbyEmail(email);
for (Acl acl : user.getAclList()) {
if (acl.getAccess().equals("allow")) {
digPackageLines(acl.getTreeId());
}
}
} else {
FacesUtils.addFatalMessage("Couldn't find user information from login!");
}
}
@WebServlet(value = "/j_security_logout")
public class LogoutServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getSession().invalidate();
response.sendRedirect("index.jsf");
}
}