Cosminexus 機能解説
ログアウトの実装例を次に示します。
...
<%
try { lc.logout(); } catch (LoginException e) { ... }
%>
...
|
セッションタイムアウト時にログアウトするには,HttpSessionBindingListenerインタフェースを継承したオブジェクトをセッションに設定します。
...
<%
session.setAttribute("loginContext", lc);
%>
...
<%@ page import="javax.security.auth.login.LoginContext" %>
...
<% session.setAttribute("logoutObject",
new HttpSessionBindingListener() {
public void valueBound(HttpSessionBindingEvent event) {}
public void valueUnbound(HttpSessionBindingEvent event) {
LoginContext lc =
(LoginContext)event.getSession().getAttribute("loginContext");
try { lc.logout(); } catch (LoginException e) { ... };
}
};);
%>
...
|
All Rights Reserved. Copyright (C) 2006, 2007, Hitachi, Ltd.