Spring integration SMB: "unknown user name" when username contains "@" character

9 hours ago 3
ARTICLE AD BOX

I'm having trouble using spring-integration-smb: when I try to authenticate a user whose name contains an "@", I get the error message "unknown user name". Interestingly, if I create a user whose name is the substring before the "@", I can log in.

Example: I have a Windows machine with a user named "[email protected]". There are shared folders on this Windows machine, and I can log in from another Windows machine using the username "[email protected]". However, when I try to log in using a service that uses spring-integration-smb, I get the following error message:

Unable to initialize share: smb://a_username%40example.com:******@example.com:445/example-share/ Logon failure: unknown user name or bad password.

Now, when I create a user with the name "a_username", without the "@example.com", using the same password and still "[email protected]" as the username, the connection works. It seems that the username recognized on the host system is somehow truncated to the characters before the "@".

The code I use for setting the credentials:

var sessionFactory = new SmbSessionFactory(); sessionFactory.setSmbMinVersion(DialectVersion.SMB1); sessionFactory.setSmbMaxVersion(DialectVersion.SMB311); sessionFactory.setHost("example.com"); sessionFactory.setPort(445); sessionFactory.setShareAndDir("example-share"); sessionFactory.setDomain(""); sessionFactory.setUsername("[email protected]"); sessionFactory.setPassword("******");

What do I need to do that it will work with usernames containing the "@" character?

Read Entire Article