private TransportConfigCallback buildTransportConfigCallback() { if (this.providerSessionFactoryEither instanceof Either.Left) return null; SshSessionFactory sshSessionFactory = ((Either.Right<CredentialsProvider, SshSessionFactory>) this.providerSessionFactoryEither).getRight(); return transport -> { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); }; } }
/** * Get the default SSH session * * @return a remote session * @throws org.eclipse.jgit.errors.TransportException * in case of error with opening SSH session */ protected RemoteSession getSession() throws TransportException { if (sock != null) return sock; final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0; final FS fs = local == null ? FS.detect() : local.getFS(); sock = sch .getSession(uri, getCredentialsProvider(), fs, tms); return sock; }
@Override public void configure(Transport transport) { if (transport instanceof SshTransport) { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory( new PropertyBasedSshSessionFactory( new SshUriPropertyProcessor(sshUriProperties).getSshKeysByHostname(), new JSch())); } } }
/** * Get the default SSH session * * @return a remote session * @throws TransportException * in case of error with opening SSH session */ protected RemoteSession getSession() throws TransportException { if (sock != null) return sock; final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0; final FS fs = local == null ? FS.detect() : local.getFS(); sock = sch .getSession(uri, getCredentialsProvider(), fs, tms); return sock; }
private void initSessionFactory() { JschConfigSessionFactory sshSessionFactory = new JschConfigSessionFactory() { @Override protected void configure(Host host, Session session) { session.setConfig("StrictHostKeyChecking", "no"); } @Override protected JSch createDefaultJSch(FS fs) throws JSchException { JSch jSch = super.createDefaultJSch(fs); // apply customized private key if (privateKeyPath != null) { jSch.removeAllIdentity(); jSch.addIdentity(privateKeyPath.toString()); } return jSch; } }; transportConfigCallback = transport -> { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); }; } }
/** * Get the default SSH session * * @return a remote session * @throws org.eclipse.jgit.errors.TransportException * in case of error with opening SSH session */ protected RemoteSession getSession() throws TransportException { if (sock != null) return sock; final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0; final FS fs = local == null ? FS.detect() : local.getFS(); sock = sch .getSession(uri, getCredentialsProvider(), fs, tms); return sock; }
((SshTransport) transport).setSshSessionFactory(new JschConfigSessionFactory() { @Override protected void configure(OpenSshConfig.Host hc, Session session) {
CloneCommand cloneCommand = Git.cloneRepository(); cloneCommand.setTransportConfigCallback( new TransportConfigCallback() { @Override public void configure( Transport transport ) { if( transport instanceof SshTransport ) { SshTransport sshTransport = ( SshTransport )transport; sshTransport.setSshSessionFactory( ... ); } } } );
@Override public void configure(final Transport transport) { final SshTransport sshTransport = (SshTransport)transport; sshTransport.setSshSessionFactory(sshSessionFactory); } });
@Override public void configure(Transport tn) { if (tn instanceof SshTransport) { ((SshTransport) tn).setSshSessionFactory(ssh); } } }
@Override public void configure( Transport transport ) { SshTransport sshTransport = ( SshTransport )transport; sshTransport.setSshSessionFactory( sshSessionFactory ); } };
@Override public void configure(Transport tn) { if (tn instanceof SshTransport) { ((SshTransport) tn).setSshSessionFactory(ssh); } } }
@Override public void configure(Transport transport) { if (transport instanceof SshTransport) { final SshTransport sshTransport = ((SshTransport) transport); sshTransport.setSshSessionFactory(sessionFactory); } } };
@Override public void configure(Transport transport) { if (transport instanceof SshTransport) { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); } }
@Override public void configure(Transport transport) { if (transport instanceof SshTransport) { ((SshTransport) transport).setSshSessionFactory(factory); } } }
@Override public void configure( Transport transport ) { SshTransport sshTransport = ( SshTransport )transport; sshTransport.setSshSessionFactory( sshSessionFactory ); } };
sshTransport.setSshSessionFactory(sshSessionFactory);
sshTransport.setSshSessionFactory(sshSessionFactory);
@Override public void configure(Transport transport) { try { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(new SshSessionFactory(context)); } catch (ClassCastException ignored) { /* If connection is HTTP */ } } }
private TransportConfigCallback buildTransportConfigCallback() { if (this.providerSessionFactoryEither instanceof Either.Left) return null; SshSessionFactory sshSessionFactory = ((Either.Right<CredentialsProvider, SshSessionFactory>) this.providerSessionFactoryEither).getRight(); return transport -> { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); }; } }