Lalit Pawar

Greenhorn
+ Follow
since Jul 08, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lalit Pawar

We are getting same message i.e. com.jcraft.jsch.JSchException: Auth fail

So we are not sure how to differentiate that message. We are using version jsch-0.1.42.jar
10 years ago
Hi

We are using JSch apis for SFTP access.
In our current project we want to differentiate between normal login failure due to invalid credentials and login failure due to account has been locked.
Can someone suggest how to do ? Below is our code snippet

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
public Session getSFTPSession(String userID, String password, int port,
String hostIP) throws IBPPException {
LOGGER.info("In getFtpSession");
JSch jsch = new JSch();
Session sftpSession = null;

try {
sftpSession = jsch.getSession(userID, hostIP, port);
LOGGER.info("sftpSession" + sftpSession);
sftpSession.setPassword(password);
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
sftpSession.setConfig(config);
sftpSession.setTimeout(10 * 60 * 1000);
sftpSession.connect();
LOGGER.info("SFT connection open");

} catch (JSchException jsche) {

LOGGER.info("Error creating SFTP session. Exception is "
+ jsche.getMessage());

throw new BusinessException(ExceptionConstants.INVALID_LOGON,
CLASS_NAME, "getSFTPSession");
}
return sftpSession;
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

10 years ago