Is there any way to get the list of currently logged in users in the system? Log

Is there any way to get the list of currently logged in users in the system? Login information parser plugin is not useful as the login-audit.csv file does not have the log-out status. Can we build a servlet filter plugin to achive this? or can we use JBoss to track the open sessions? any ideas?...

OriginalPostID-113347

OriginalPostID-113347

  Discussion posts and replies are publicly visible

Parents
  • Quick dirty solution (or may be not) -> Go back to java -> write a Session Listener like below:

    public void sessionCreated(HttpSessionEvent se) {
    //Creating new session...
    activeSessions += 1;
    SessionCounterDao.getInstance().pushActiveSessionToDB(se.getSession());
    System.out.println("New session Created..." + se.getSession().getId());

    }

    public void sessionDestroyed(HttpSessionEvent se) {

    System.out.print("Destroying... " + se.getSession().getId());
    SessionCounterDao.getInstance().popDestroyedSessionFromDB(se.getSession());
    if (activeSessions > 0) {
    activeSessions -= 1;
    }
    System.out.println(" --> Destroyed");

    }

    You have now SPRING_SECURITY_CONTEXT there

    String springSecContext = (String)session.getAttribute("SPRING_SECURITY_CONTEXT"); /* geeting all sesision info here */

    Enjoy!!
Reply
  • Quick dirty solution (or may be not) -> Go back to java -> write a Session Listener like below:

    public void sessionCreated(HttpSessionEvent se) {
    //Creating new session...
    activeSessions += 1;
    SessionCounterDao.getInstance().pushActiveSessionToDB(se.getSession());
    System.out.println("New session Created..." + se.getSession().getId());

    }

    public void sessionDestroyed(HttpSessionEvent se) {

    System.out.print("Destroying... " + se.getSession().getId());
    SessionCounterDao.getInstance().popDestroyedSessionFromDB(se.getSession());
    if (activeSessions > 0) {
    activeSessions -= 1;
    }
    System.out.println(" --> Destroyed");

    }

    You have now SPRING_SECURITY_CONTEXT there

    String springSecContext = (String)session.getAttribute("SPRING_SECURITY_CONTEXT"); /* geeting all sesision info here */

    Enjoy!!
Children
No Data