0

我对会话管理有要求。

我有自定义登录页面.net。成功认证后,无论用户是单因素还是二因素,都将验证 OTP 这是一个 JSP 页面的用户。受 OAM 保护。

在为用户验证 OTP 之前,我需要编写代码来验证:

  1. 如果用户会话已经存在或不存在?
  2. a) 如果会话存在,用户应该得到一个页面,其中包含继续旧会话或新会话的选项。

    I. 如果用户点击旧会话,则用户将从当前会话中注销并可以继续旧会话。

    二、如果用户单击新会话,则用户旧会话将被终止并继续新会话。

    b) 如果用户会话不存在,则用户将在验证 otp 后登录 App。

有人可以给我一个关于如何为此编写代码的想法吗?

4

1 回答 1

0

您可以 为此使用HttpSession 。

  1. If user session already exists or not?

    检查会话是否为空。

    request.getSession() != null

  2. If user clicks on old session, then user will be logged out from current session and can continue old session.

    利用:

    request.getSession(false) ;

3) If user clicks on new session, then user old session will be terminated and continues with new session.

利用:

session.invalidate();

request.getSession() ;

于 2013-07-30T06:08:10.463 回答