use of org.eclipse.sw360.fossology.ssh.keyrepo.FossologyHostKeyRepository in project sw360portal by sw360.
the class RealSshConnectionUtils method getTrustingJSchSessionFactory.
static JSchSessionProvider getTrustingJSchSessionFactory() {
FossologyFingerPrintRepository keyConnector = mock(FossologyFingerPrintRepository.class);
FossologyHostKeyRepository hostKeyRepository = spy(new FossologyHostKeyRepository(keyConnector));
doReturn(HostKeyRepository.OK).when(hostKeyRepository).check(anyString(), any(byte[].class));
return new JSchSessionProvider(new FossologySettings(), hostKeyRepository);
}
use of org.eclipse.sw360.fossology.ssh.keyrepo.FossologyHostKeyRepository in project sw360portal by sw360.
the class JSchSessionProvider method doGetSession.
private Session doGetSession(int connectionTimeout) throws SW360Exception {
synchronized (J_SCH) {
try {
Session session = J_SCH.getSession(userName, hostName, hostPort);
session.setHostKeyRepository(fossologyHostKeyRepository);
session.connect(connectionTimeout);
return session;
} catch (JSchException e) {
String serverString = getServerString();
log.error("cannot connect to fossology server: " + serverString, e);
throw new SW360Exception("cannot connect to Fossology Server");
}
}
}
Aggregations