import java.util.List;
import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
import org.apache.catalina.Realm;
*/
protected LoginContext loginContext = null;
- public LoginContext getLoginContext() {
- return loginContext;
- }
-
-
// --------------------------------------------------------- Public Methods
}
+
+ /**
+ * Calls logout, if necessary, on any associated JAASLoginContext. May in
+ * the future be extended to cover other logout requirements.
+ *
+ * @throws Exception If something goes wrong with the logout. Uses Exception
+ * to allow for future expansion of this method to cover
+ * other logout mechanisms that might throw a different
+ * exception to LoginContext
+ *
+ */
+ public void logout() throws Exception {
+ if (loginContext != null) {
+ loginContext.logout();
+ }
+ }
+
+
}
standardSession.getId.ise=getId: Session already invalidated
standardSession.getMaxInactiveInterval.ise=getMaxInactiveInterval: Session already invalidated
standardSession.getValueNames.ise=getValueNames: Session already invalidated
-standardSession.jaaslogoutfail=Exception logging out user when expiring session
+standardSession.logoutfail=Exception logging out user when expiring session
standardSession.notSerializable=Cannot serialize session attribute {0} for session {1}
standardSession.removeAttribute.ise=removeAttribute: Session already invalidated
standardSession.sessionEvent=Session event listener threw exception
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
-import javax.security.auth.login.LoginException;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionActivationListener;
fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
}
- // Call the JAAS logout method if necessary
+ // Call the logout method
if (principal instanceof GenericPrincipal) {
GenericPrincipal gp = (GenericPrincipal) principal;
- if (gp.getLoginContext() != null) {
- try {
- gp.getLoginContext().logout();
- } catch (LoginException e) {
- manager.getContainer().getLogger().error(
- sm.getString("standardSession.jaaslogoutfail"),
- e);
- }
+ try {
+ gp.logout();
+ } catch (Exception e) {
+ manager.getContainer().getLogger().error(
+ sm.getString("standardSession.logoutfail"),
+ e);
}
}