Skip to content

Commit

Permalink
G2-1545 Support shared SSH client in SFTP filesystems
Browse files Browse the repository at this point in the history
  • Loading branch information
gdgib committed Mar 1, 2024
1 parent 48e89a1 commit ce4cb4c
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 ce4cb4c

Please sign in to comment.