*
* @param subject user making the request
* @param sshSession the session that is currently connected
*/
private void processRememberMe(Subject subject, SSHInstallUtility sshSession) {
RemoteAccessInfo remoteAccessInfo = sshSession.getRemoteAccessInfo();
String agentName = remoteAccessInfo.getAgentName();
if (agentName == null) {
return; // nothing we can do, don't know what agent this is for
}
boolean credentialsOK = sshSession.isConnected();
if (!credentialsOK) {
return; // do not store anything - the credentials are probably bad and why we aren't connected so no sense remembering them
}
AgentInstall ai = agentManager.getAgentInstallByAgentName(subject, agentName);
if (ai == null) {
ai = new AgentInstall();
ai.setAgentName(agentName);
}
// ai.setSshHost(remoteAccessInfo.getHost()); do NOT change the host
ai.setSshPort(remoteAccessInfo.getPort());
if (remoteAccessInfo.getRememberMe()) {
ai.setSshUsername(remoteAccessInfo.getUser());
ai.setSshPassword(remoteAccessInfo.getPassword());
} else {
// user doesn't want to remember the creds, set them to "" which tells our persistence layer to null them out
ai.setSshUsername("");
ai.setSshPassword("");
}