use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.
the class SecureShellKtrl method createSession.
@Kontrol(path = "/admin/createSession", method = MethodType.GET)
public String createSession() throws ServletException {
Long userId = null;
try {
userId = AuthUtil.getUserId(getRequest().getSession());
} catch (GeneralSecurityException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
if (systemSelectId != null && !systemSelectId.isEmpty()) {
try {
SystemStatusDB.setInitialSystemStatus(systemSelectId, userId, AuthUtil.getUserType(getRequest().getSession()));
pendingSystemStatus = SystemStatusDB.getNextPendingSystem(userId);
createTerms();
} catch (SQLException | GeneralSecurityException | ServletException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
}
return null;
}
use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.
the class SecureShellKtrl method selectSystemsForCompositeTerms.
@Kontrol(path = "/admin/selectSystemsForCompositeTerms", method = MethodType.GET)
public String selectSystemsForCompositeTerms() throws ServletException {
if (systemSelectId != null && !systemSelectId.isEmpty()) {
try {
Long userId = AuthUtil.getUserId(getRequest().getSession());
SystemStatusDB.setInitialSystemStatus(systemSelectId, userId, AuthUtil.getUserType(getRequest().getSession()));
pendingSystemStatus = SystemStatusDB.getNextPendingSystem(userId);
User user = UserDB.getUser(userId);
user.setIpAddress(AuthUtil.getClientIPAddress(getRequest()));
AuthUtil.setSessionId(getRequest().getSession(), SessionAuditDB.createSessionLog(user));
} catch (SQLException | GeneralSecurityException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
}
return "/admin/secure_shell.html";
}
use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.
the class SecureShellKtrl method disconnectTerm.
@Kontrol(path = "/admin/disconnectTerm", method = MethodType.GET)
public String disconnectTerm() throws ServletException {
Long sessionId = null;
try {
sessionId = AuthUtil.getSessionId(getRequest().getSession());
} catch (GeneralSecurityException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
if (SecureShellKtrl.getUserSchSessionMap() != null) {
UserSchSessions userSchSessions = SecureShellKtrl.getUserSchSessionMap().get(sessionId);
if (userSchSessions != null) {
SchSession schSession = userSchSessions.getSchSessionMap().get(id);
// disconnect ssh session
if (schSession != null) {
if (schSession.getChannel() != null)
schSession.getChannel().disconnect();
if (schSession.getSession() != null)
schSession.getSession().disconnect();
schSession.setChannel(null);
schSession.setSession(null);
schSession.setInputToChannel(null);
schSession.setCommander(null);
schSession.setOutFromChannel(null);
}
// remove from map
userSchSessions.getSchSessionMap().remove(id);
}
}
return null;
}
use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.
the class SessionAuditKtrl method getJSONTermOutputForSession.
@Kontrol(path = "/manage/getJSONTermOutputForSession", method = MethodType.GET)
public String getJSONTermOutputForSession() throws ServletException {
try {
String json = new Gson().toJson(SessionAuditDB.getTerminalLogsForSession(sessionId, instanceId));
getResponse().getOutputStream().write(json.getBytes());
} catch (SQLException | GeneralSecurityException | IOException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
return null;
}
use of loophole.mvc.annotation.Kontrol in project KeyBox by skavanagh.
the class SystemKtrl method viewAdminSystems.
@Kontrol(path = "/admin/viewSystems", method = MethodType.GET)
public String viewAdminSystems() throws ServletException {
try {
Long userId = AuthUtil.getUserId(getRequest().getSession());
if (Auth.MANAGER.equals(AuthUtil.getUserType(getRequest().getSession()))) {
sortedSet = SystemDB.getSystemSet(sortedSet);
profileList = ProfileDB.getAllProfiles();
} else {
sortedSet = SystemDB.getUserSystemSet(sortedSet, userId);
profileList = UserProfileDB.getProfilesByUser(userId);
}
if (script != null && script.getId() != null) {
script = ScriptDB.getScript(script.getId(), userId);
}
} catch (SQLException | GeneralSecurityException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
return "/admin/view_systems.html";
}
Aggregations