Search in sources :

Example 1 with UserSessionsOutput

use of com.keybox.manage.model.UserSessionsOutput in project KeyBox by skavanagh.

the class SessionOutputUtil method removeUserSession.

/**
     * removes session for user session
     *
     * @param sessionId session id
     */
public static void removeUserSession(Long sessionId) {
    UserSessionsOutput userSessionsOutput = userSessionsOutputMap.get(sessionId);
    if (userSessionsOutput != null) {
        userSessionsOutput.getSessionOutputMap().clear();
    }
    userSessionsOutputMap.remove(sessionId);
}
Also used : UserSessionsOutput(com.keybox.manage.model.UserSessionsOutput)

Example 2 with UserSessionsOutput

use of com.keybox.manage.model.UserSessionsOutput in project KeyBox by skavanagh.

the class SessionOutputUtil method addOutput.

/**
     * adds a new output
     *
     * @param sessionOutput session output object
     */
public static void addOutput(SessionOutput sessionOutput) {
    UserSessionsOutput userSessionsOutput = userSessionsOutputMap.get(sessionOutput.getSessionId());
    if (userSessionsOutput == null) {
        userSessionsOutputMap.put(sessionOutput.getSessionId(), new UserSessionsOutput());
        userSessionsOutput = userSessionsOutputMap.get(sessionOutput.getSessionId());
    }
    userSessionsOutput.getSessionOutputMap().put(sessionOutput.getInstanceId(), sessionOutput);
}
Also used : UserSessionsOutput(com.keybox.manage.model.UserSessionsOutput)

Example 3 with UserSessionsOutput

use of com.keybox.manage.model.UserSessionsOutput in project KeyBox by skavanagh.

the class SessionOutputUtil method getOutput.

/**
     * returns list of output lines
     *
     * @param sessionId session id object
     * @param user user auth object
     * @return session output list
     */
public static List<SessionOutput> getOutput(Connection con, Long sessionId, User user) {
    List<SessionOutput> outputList = new ArrayList<>();
    UserSessionsOutput userSessionsOutput = userSessionsOutputMap.get(sessionId);
    if (userSessionsOutput != null) {
        for (Integer key : userSessionsOutput.getSessionOutputMap().keySet()) {
            //get output chars and set to output
            try {
                SessionOutput sessionOutput = userSessionsOutput.getSessionOutputMap().get(key);
                if (sessionOutput != null && sessionOutput.getOutput() != null && StringUtils.isNotEmpty(sessionOutput.getOutput())) {
                    outputList.add(sessionOutput);
                    //send to audit logger
                    systemAuditLogger.info(gson.toJson(new AuditWrapper(user, sessionOutput)));
                    if (enableInternalAudit) {
                        SessionAuditDB.insertTerminalLog(con, sessionOutput);
                    }
                    userSessionsOutput.getSessionOutputMap().put(key, new SessionOutput(sessionId, sessionOutput));
                }
            } catch (Exception ex) {
                log.error(ex.toString(), ex);
            }
        }
    }
    return outputList;
}
Also used : AuditWrapper(com.keybox.manage.model.AuditWrapper) SessionOutput(com.keybox.manage.model.SessionOutput) UserSessionsOutput(com.keybox.manage.model.UserSessionsOutput)

Aggregations

UserSessionsOutput (com.keybox.manage.model.UserSessionsOutput)3 AuditWrapper (com.keybox.manage.model.AuditWrapper)1 SessionOutput (com.keybox.manage.model.SessionOutput)1