spring integration, how do multiple ssh / switch local user before conencte to remot server

Viewed 21

Can we do something like:

ssh user1@localhost

scp user2@remote:resource/test.txt dest/text.txt

in Spring integration ?

1 Answers

Spring Integration doesn't do any SSH direct connection. That one is used only for SFTP protocol. And this one is handled by the DefaultSftpSessionFactory. For convenience we have a DelegatingSessionFactory which may decide which target factory to chose according a provided key. Which by default can be stored in the ThreadLocal. What you saying looks like a dynamic connection based on the provided user. Probably it can be done as a custom SessionFactory implementation which will do a lazy delegation after creating the target factory according provided credentials.

Related