我在会话管理OAM中有一个要求

时间:2013-07-30 05:44:24

标签: java session

我在会话管理方面有要求。

我在.net中有自定义登录页面。验证成功后,将验证用户是否为OTP,这是一个JSP页面,无论用户是单因素还是2因子。受OAM保护。

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

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

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

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

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

  3. 有人可以就如何为此编写代码给我一个想法吗?

1 个答案:

答案 0 :(得分: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. 3)If user clicks on new session, then user old session will be terminated and continues with new session.

    使用:

    session.invalidate();

    request.getSession();