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); }; } }
@Override public void configure(Transport transport) { if (transport instanceof SshTransport) { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory( new PropertyBasedSshSessionFactory( new SshUriPropertyProcessor(sshUriProperties).getSshKeysByHostname(), new JSch())); } } }
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); }; } }
((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 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 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 ); } };
@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); }; } }
private <T extends TransportCommand<?, ?>> void configureSsh(T cmd, PasswordMirrorCredential cred) { cmd.setTransportConfigCallback(transport -> { final SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(new JschConfigSessionFactory() { @Override protected void configure(Host host, Session session) { try { session.setHostKeyRepository( new MirrorHostKeyRepository(mirror.localRepo().parent().metaRepo())); session.setPassword(cred.password()); } catch (MirrorException e) { throw e; } catch (Exception e) { throw new MirrorException(e); } } }); }); }
private <T extends TransportCommand<?, ?>> void configureSsh(T cmd, PublicKeyMirrorCredential cred) { cmd.setTransportConfigCallback(transport -> { final SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(new JschConfigSessionFactory() { @Override protected void configure(Host host, Session session) { try { session.setHostKeyRepository( new MirrorHostKeyRepository(mirror.localRepo().parent().metaRepo())); session.setIdentityRepository(new MirrorIdentityRepository( cred.username() + '@' + host.getHostName(), cred)); } catch (MirrorException e) { throw e; } catch (Exception e) { throw new MirrorException(e); } } }); }); }
private <T extends TransportCommand<?, ?>> void configureSsh(T cmd, PasswordMirrorCredential cred) { cmd.setTransportConfigCallback(transport -> { final SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(new JschConfigSessionFactory() { @Override protected void configure(Host host, Session session) { try { session.setHostKeyRepository( new MirrorHostKeyRepository(mirror.localRepo().parent().metaRepo())); session.setPassword(cred.password()); } catch (MirrorException e) { throw e; } catch (Exception e) { throw new MirrorException(e); } } }); }); }
private <T extends TransportCommand<?, ?>> void configureSsh(T cmd, PasswordMirrorCredential cred) { cmd.setTransportConfigCallback(transport -> { final SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(new JschConfigSessionFactory() { @Override protected void configure(Host host, Session session) { try { session.setHostKeyRepository( new MirrorHostKeyRepository(mirror.localRepo().parent().metaRepo())); session.setPassword(cred.password()); } catch (MirrorException e) { throw e; } catch (Exception e) { throw new MirrorException(e); } } }); }); }
private <T extends TransportCommand<?, ?>> void configureSsh(T cmd, PublicKeyMirrorCredential cred) { cmd.setTransportConfigCallback(transport -> { final SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(new JschConfigSessionFactory() { @Override protected void configure(Host host, Session session) { try { session.setHostKeyRepository( new MirrorHostKeyRepository(mirror.localRepo().parent().metaRepo())); session.setIdentityRepository(new MirrorIdentityRepository( cred.username() + '@' + host.getHostName(), cred)); } catch (MirrorException e) { throw e; } catch (Exception e) { throw new MirrorException(e); } } }); }); }