INT-3935: Add Jsch Proxy Factory Bean

JIRA: https://jira.spring.io/browse/INT-3935
This commit is contained in:
Gary Russell
2016-01-19 16:16:22 -05:00
committed by Artem Bilan
parent c0784bf6ef
commit 62db308c22
4 changed files with 225 additions and 1 deletions

View File

@@ -129,7 +129,8 @@ Optional.
*proxy*
Allows for specifying a JSch-based http://epaul.github.com/jsch-documentation/javadoc/com/jcraft/jsch/Proxy.html[Proxy].
If set, then the proxy object is used to create the connection to the remote host.
If set, then the proxy object is used to create the connection to the remote host via the proxy.
See <<sftp-proxy-factory-bean>> for a convenient way to configure the proxy.
*serverAliveCountMax*
@@ -177,6 +178,33 @@ Also see `allowUnknownHosts`.
When a `UserInfo` is provided, the `password` and private key `passphrase` is obtained from it, and discrete
`password` and `privateKeyPassprase` properties cannot be set.
[[sftp-proxy-factory-bean]]
=== Proxy Factory Bean
`Jsch` provides a mechanism to connect to the server via an HTTP or SOCKS proxy.
To use this feature, configure the `Proxy` and provide a reference to the `DefaultSftpSessionFactory` as discussed
above.
Three implementations are provided by `Jsch`, `HTTP`, `SOCKS4` and `SOCKS5`.
_Spring Integration 4.3_ provides a `FactoryBean` making configuration of these proxies easier, allowing property
injection:
[source, xml]
----
<bean id="proxySocks5" class="org.springframework.integration.sftp.session.JschProxyFactoryBean">
<constructor-arg value="SOCKS5" />
<constructor-arg value="${sftp.proxy.address}" />
<constructor-arg value="${sftp.proxy.port}" />
<constructor-arg value="${sftp.proxy.user}" />
<constructor-arg value="${sftp.proxy.pw}" />
</bean>
<bean id="sessionFactory"
class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory" >
...
<property name="proxy" ref="proxySocks5" />
...
</bean>
----
[[sftp-dsf]]
=== Delegating Session Factory

View File

@@ -92,3 +92,8 @@ Previously, with requests that had a body (such as `POST`) that had no `content-
With this release, the content type of such requests is considered to be `application/octet-stream` as recommended
by RFC 2616.
See <<http-inbound>> for more information.
==== SFTP Changes
A new factory bean is provided to simplify the configuration of Jsch proxies for SFTP.
See <<sftp-proxy-factory-bean>> for more information.