use of io.bastillion.manage.model.SortedSet in project KeyBox by skavanagh.
the class AuthKeysKtrl method enablePublicKey.
@Kontrol(path = "/manage/enablePublicKey", method = MethodType.GET)
public String enablePublicKey() throws ServletException {
try {
publicKey = PublicKeyDB.getPublicKey(publicKey.getId());
PublicKeyDB.enableKey(publicKey.getId());
profileList = ProfileDB.getAllProfiles();
userList = UserDB.getUserSet(new SortedSet(SessionAuditDB.SORT_BY_USERNAME)).getItemList();
sortedSet = PublicKeyDB.getPublicKeySet(sortedSet);
} catch (SQLException | GeneralSecurityException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
distributePublicKeys(publicKey);
return "/manage/view_keys.html";
}
use of io.bastillion.manage.model.SortedSet in project KeyBox by skavanagh.
the class SecureShellKtrl method createTerms.
/**
* creates composite terminals if there are errors or authentication issues.
*/
@Kontrol(path = "/admin/createTerms", method = MethodType.POST)
public String createTerms() throws ServletException {
try {
Long userId = AuthUtil.getUserId(getRequest().getSession());
Long sessionId = AuthUtil.getSessionId(getRequest().getSession());
if (pendingSystemStatus != null && pendingSystemStatus.getId() != null) {
// get status
currentSystemStatus = SystemStatusDB.getSystemStatus(pendingSystemStatus.getId(), userId);
// if initial status run script
if (currentSystemStatus != null && (HostSystem.INITIAL_STATUS.equals(currentSystemStatus.getStatusCd()) || HostSystem.AUTH_FAIL_STATUS.equals(currentSystemStatus.getStatusCd()) || HostSystem.PUBLIC_KEY_FAIL_STATUS.equals(currentSystemStatus.getStatusCd()))) {
// set current session
currentSystemStatus = SSHUtil.openSSHTermOnSystem(passphrase, password, userId, sessionId, currentSystemStatus, userSchSessionMap);
}
if (currentSystemStatus != null && (HostSystem.AUTH_FAIL_STATUS.equals(currentSystemStatus.getStatusCd()) || HostSystem.PUBLIC_KEY_FAIL_STATUS.equals(currentSystemStatus.getStatusCd()))) {
pendingSystemStatus = currentSystemStatus;
} else {
pendingSystemStatus = SystemStatusDB.getNextPendingSystem(userId);
// if success loop through systems until finished or need password
while (pendingSystemStatus != null && currentSystemStatus != null && HostSystem.SUCCESS_STATUS.equals(currentSystemStatus.getStatusCd())) {
currentSystemStatus = SSHUtil.openSSHTermOnSystem(passphrase, password, userId, sessionId, pendingSystemStatus, userSchSessionMap);
pendingSystemStatus = SystemStatusDB.getNextPendingSystem(userId);
}
}
}
// set system list if no pending systems
if (SystemStatusDB.getNextPendingSystem(userId) == null) {
setSystemList(userId, sessionId);
// set allocated systems for connect to
SortedSet sortedSet = new SortedSet();
sortedSet.setOrderByField(SystemDB.SORT_BY_NAME);
if (Auth.MANAGER.equals(AuthUtil.getUserType(getRequest().getSession()))) {
sortedSet = SystemDB.getSystemSet(sortedSet);
} else {
sortedSet = SystemDB.getUserSystemSet(sortedSet, userId);
}
if (sortedSet.getItemList() != null) {
allocatedSystemList = (List<HostSystem>) sortedSet.getItemList();
}
// set theme
this.userSettings = UserThemeDB.getTheme(userId);
}
} catch (SQLException | GeneralSecurityException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
return "/admin/secure_shell.html";
}
use of io.bastillion.manage.model.SortedSet in project KeyBox by skavanagh.
the class SessionAuditKtrl method viewSessions.
@Kontrol(path = "/manage/viewSessions", method = MethodType.GET)
public String viewSessions() throws ServletException {
if (sortedSet.getOrderByField() == null || sortedSet.getOrderByField().trim().equals("")) {
sortedSet.setOrderByField(SessionAuditDB.SORT_BY_SESSION_TM);
sortedSet.setOrderByDirection("desc");
}
try {
systemList = SystemDB.getSystemSet(new SortedSet(SystemDB.SORT_BY_NAME)).getItemList();
userList = UserDB.getUserSet(new SortedSet(SessionAuditDB.SORT_BY_USERNAME)).getItemList();
sortedSet = SessionAuditDB.getSessions(sortedSet);
} catch (SQLException | GeneralSecurityException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
return "/manage/view_sessions.html";
}
use of io.bastillion.manage.model.SortedSet in project KeyBox by skavanagh.
the class SystemStatusDB method getSortedSetStatus.
/**
* returns all key placement statuses
*
* @param userId user id
*/
public static SortedSet getSortedSetStatus(Long userId) throws SQLException, GeneralSecurityException {
SortedSet sortedSet = new SortedSet();
sortedSet.setItemList(getAllSystemStatus(userId));
return sortedSet;
}
use of io.bastillion.manage.model.SortedSet in project KeyBox by skavanagh.
the class AuthKeysKtrl method disablePublicKey.
@Kontrol(path = "/manage/disablePublicKey", method = MethodType.GET)
public String disablePublicKey() throws ServletException {
try {
publicKey = PublicKeyDB.getPublicKey(publicKey.getId());
PublicKeyDB.disableKey(publicKey.getId());
profileList = ProfileDB.getAllProfiles();
userList = UserDB.getUserSet(new SortedSet(SessionAuditDB.SORT_BY_USERNAME)).getItemList();
sortedSet = PublicKeyDB.getPublicKeySet(sortedSet);
} catch (SQLException | GeneralSecurityException ex) {
log.error(ex.toString(), ex);
throw new ServletException(ex.toString(), ex);
}
distributePublicKeys(publicKey);
return "/manage/view_keys.html";
}
Aggregations