私の JSF アプリケーションでは、現在サインインしているユーザーの名前を次のように取得します...
public String getLoggedInUsername() {
return FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();
}
...そして、ユーザーがこのようにサインインしているかどうかを確認します...
public boolean isSignedIn() {
return (getLoggedInUsername() != null);
}
...そして、ユーザーがサインアウトするとき、私はこれを行います...
public String doLogout() {
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpSession httpSession = (HttpSession)facesContext.getExternalContext().getSession(false);
httpSession.invalidate();
return "main";
}
私の問題は doLogout() の後です。getLoggedInUsername() はログインしたユーザーの名前を返します。ログアウト後に getRemoteUser() が null を返すようにするにはどうすればよいですか?
または、ユーザー名を確認するだけでなく、 isSignedIn() を取得するより良い方法はありますか?
ありがとう!ロブ