Skip to content

Commit

Permalink
Merge pull request #121 from gdgib/G2-1545-ClientSFTP
Browse files Browse the repository at this point in the history
G2-1545 Support shared SSH client in SFTP filesystems
  • Loading branch information
gdgib authored Mar 1, 2024
2 parents 728ad82 + ce4cb4c commit eb781db
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gb-ssh/src/main/java/com/g2forge/gearbox/ssh/SSHConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ public ClientSession connect(SshClient client) {
}

public FileSystem createFileSystem() {
final SftpFileSystemProvider provider = new SftpFileSystemProvider();
return createFileSystem(null /* This works because SftpFileSystemProvider does this anyway for the no-arg constructor */);
}

public FileSystem createFileSystem(SshClient client) {
final SftpFileSystemProvider provider = new SftpFileSystemProvider(client);
provider.setSftpFileSystemClientSessionInitializer(new SftpFileSystemClientSessionInitializer() {
@Override
public void authenticateClientSession(SftpFileSystemProvider provider, SftpFileSystemInitializationContext context, ClientSession session) throws IOException {
Expand Down

0 comments on commit eb781db

Please sign in to comment.