Class HttpClientConnector
- java.lang.Object
-
- org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector
-
- org.eclipse.jgit.internal.transport.sshd.proxy.HttpClientConnector
-
- All Implemented Interfaces:
org.apache.sshd.client.session.ClientProxyConnector
,StatefulProxyConnector
public class HttpClientConnector extends AbstractClientProxyConnector
Simple HTTP proxy connector using Basic Authentication.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interface
HttpClientConnector.HttpAuthenticationHandler
private class
HttpClientConnector.HttpBasicAuthentication
private class
HttpClientConnector.NegotiateAuthentication
-
Field Summary
Fields Modifier and Type Field Description private HttpClientConnector.HttpAuthenticationHandler
authenticator
private java.util.List<HttpClientConnector.HttpAuthenticationHandler>
availableAuthentications
private HttpClientConnector.HttpAuthenticationHandler
basic
private java.util.Iterator<HttpClientConnector.HttpAuthenticationHandler>
clientAuthentications
private static java.lang.String
HTTP_HEADER_PROXY_AUTHENTICATION
private static java.lang.String
HTTP_HEADER_PROXY_AUTHORIZATION
private HttpClientConnector.HttpAuthenticationHandler
negotiate
private boolean
ongoing
-
Fields inherited from class org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector
proxyAddress, proxyPassword, proxyUser, remoteAddress
-
Fields inherited from interface org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector
TIMEOUT_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description HttpClientConnector(java.net.InetSocketAddress proxyAddress, java.net.InetSocketAddress remoteAddress)
Creates a newHttpClientConnector
.HttpClientConnector(java.net.InetSocketAddress proxyAddress, java.net.InetSocketAddress remoteAddress, java.lang.String proxyUser, char[] proxyPassword)
Creates a newHttpClientConnector
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringBuilder
authenticate(java.lang.StringBuilder msg, java.lang.String token)
private void
close()
private java.lang.StringBuilder
connect()
private java.lang.StringBuilder
eol(java.lang.StringBuilder msg)
private AuthenticationChallenge
getByName(java.util.List<AuthenticationChallenge> challenges, java.lang.String name)
private void
handleMessage(org.apache.sshd.common.io.IoSession session, java.util.List<java.lang.String> reply)
void
messageReceived(org.apache.sshd.common.io.IoSession session, org.apache.sshd.common.util.Readable buffer)
Handle a received message.private HttpClientConnector.HttpAuthenticationHandler
selectProtocol(java.util.List<AuthenticationChallenge> challenges, HttpClientConnector.HttpAuthenticationHandler current)
private void
send(java.lang.StringBuilder msg, org.apache.sshd.common.io.IoSession session)
void
sendClientProxyMetadata(org.apache.sshd.client.session.ClientSession sshSession)
-
Methods inherited from class org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector
adjustTimeout, clearPassword, getTimeout, init, runWhenDone, setDone
-
-
-
-
Field Detail
-
HTTP_HEADER_PROXY_AUTHENTICATION
private static final java.lang.String HTTP_HEADER_PROXY_AUTHENTICATION
- See Also:
- Constant Field Values
-
HTTP_HEADER_PROXY_AUTHORIZATION
private static final java.lang.String HTTP_HEADER_PROXY_AUTHORIZATION
- See Also:
- Constant Field Values
-
basic
private HttpClientConnector.HttpAuthenticationHandler basic
-
negotiate
private HttpClientConnector.HttpAuthenticationHandler negotiate
-
availableAuthentications
private java.util.List<HttpClientConnector.HttpAuthenticationHandler> availableAuthentications
-
clientAuthentications
private java.util.Iterator<HttpClientConnector.HttpAuthenticationHandler> clientAuthentications
-
authenticator
private HttpClientConnector.HttpAuthenticationHandler authenticator
-
ongoing
private boolean ongoing
-
-
Constructor Detail
-
HttpClientConnector
public HttpClientConnector(@NonNull java.net.InetSocketAddress proxyAddress, @NonNull java.net.InetSocketAddress remoteAddress)
Creates a newHttpClientConnector
. The connector supports anonymous proxy connections as well as Basic and Negotiate authentication.- Parameters:
proxyAddress
- of the proxy server we're connecting toremoteAddress
- of the target server to connect to
-
HttpClientConnector
public HttpClientConnector(@NonNull java.net.InetSocketAddress proxyAddress, @NonNull java.net.InetSocketAddress remoteAddress, java.lang.String proxyUser, char[] proxyPassword)
Creates a newHttpClientConnector
. The connector supports anonymous proxy connections as well as Basic and Negotiate authentication. If a user name and password are given, the connector tries pre-emptive Basic authentication.- Parameters:
proxyAddress
- of the proxy server we're connecting toremoteAddress
- of the target server to connect toproxyUser
- to authenticate at the proxy withproxyPassword
- to authenticate at the proxy with
-
-
Method Detail
-
close
private void close()
-
sendClientProxyMetadata
public void sendClientProxyMetadata(org.apache.sshd.client.session.ClientSession sshSession) throws java.lang.Exception
- Throws:
java.lang.Exception
-
send
private void send(java.lang.StringBuilder msg, org.apache.sshd.common.io.IoSession session) throws java.lang.Exception
- Throws:
java.lang.Exception
-
connect
private java.lang.StringBuilder connect()
-
authenticate
private java.lang.StringBuilder authenticate(java.lang.StringBuilder msg, java.lang.String token)
-
eol
private java.lang.StringBuilder eol(java.lang.StringBuilder msg)
-
messageReceived
public void messageReceived(org.apache.sshd.common.io.IoSession session, org.apache.sshd.common.util.Readable buffer) throws java.lang.Exception
Description copied from interface:StatefulProxyConnector
Handle a received message.- Parameters:
session
- to use for writing databuffer
- received data- Throws:
java.lang.Exception
- if data cannot be read, or the connection attempt fails
-
handleMessage
private void handleMessage(org.apache.sshd.common.io.IoSession session, java.util.List<java.lang.String> reply) throws java.lang.Exception
- Throws:
java.lang.Exception
-
selectProtocol
private HttpClientConnector.HttpAuthenticationHandler selectProtocol(java.util.List<AuthenticationChallenge> challenges, HttpClientConnector.HttpAuthenticationHandler current) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getByName
private AuthenticationChallenge getByName(java.util.List<AuthenticationChallenge> challenges, java.lang.String name)
-
-