Skip to content

Add SFTP password authentication tests for Commons VFS2#754

Open
VaishKumbhar wants to merge 1 commit intoapache:masterfrom
VaishKumbhar:sftp-password-auth-test
Open

Add SFTP password authentication tests for Commons VFS2#754
VaishKumbhar wants to merge 1 commit intoapache:masterfrom
VaishKumbhar:sftp-password-auth-test

Conversation

@VaishKumbhar
Copy link
Copy Markdown

What

Adds SftpPasswordAuthTest — new test class that verify SFTP password authentication via StaticUserAuthenticator in Commons VFS2.

Why

There is no dedicated test for SFTP password-based authentication. The existing SftpProviderTest relies on SftpTestServerHelper which accepts username == password and also allows UserAuthNone, so it does not specifically validate that StaticUserAuthenticator credentials are correctly propagated through the VFS2 SFTP provider.

How

  • Each test spins up an inline embedded SSHD 0.8.0 server with a strict PasswordAuthenticator that only accepts a specific username/password pair.
  • The server uses an explicit RSA 2048-bit host key instead of the SSHD 0.8.0 default DSA key, which is incompatible with Java 17+ (disabled legacy crypto algorithms).
  • Server teardown uses a daemon thread with a 5-second timeout to prevent JVM hangs caused by SSHD 0.8.0 lingering sessions after failed authentication.
  • Tests verify: resolving files, resolving folders (with and without trailing slash), and that wrong credentials produce a FileSystemException.

Test summary

Test Description
testResolveFile Connects with correct credentials, resolves a file, asserts it exists and is readable
testResolveFolder Connects with correct credentials, resolves a directory
testResolveFolderWithTrailingSlash Same as above with trailing slash in URI
testWrongCredentialsThrowsException Connects with wrong credentials, asserts FileSystemException is thrown

Copy link
Copy Markdown
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @VaishKumbhar

Thank you for the PR.

Please see my comments.

@VaishKumbhar VaishKumbhar force-pushed the sftp-password-auth-test branch from 8c2faeb to ff5b8da Compare March 30, 2026 06:03
@VaishKumbhar
Copy link
Copy Markdown
Author

Hi @garydgregory
Request change was done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants