Search in sources :

Example 1 with UserSessionsOutput

use of io.bastillion.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) throws SQLException {
    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
            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));
            }
        }
    }
    return outputList;
}
Also used : AuditWrapper(io.bastillion.manage.model.AuditWrapper) SessionOutput(io.bastillion.manage.model.SessionOutput) UserSessionsOutput(io.bastillion.manage.model.UserSessionsOutput)

Example 2 with UserSessionsOutput

use of io.bastillion.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(io.bastillion.manage.model.UserSessionsOutput)

Example 3 with UserSessionsOutput

use of io.bastillion.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(io.bastillion.manage.model.UserSessionsOutput)

Aggregations

UserSessionsOutput (io.bastillion.manage.model.UserSessionsOutput)3 AuditWrapper (io.bastillion.manage.model.AuditWrapper)1 SessionOutput (io.bastillion.manage.model.SessionOutput)1