Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.transport.sshd.proxy

public Class HttpClientConnector

extends AbstractClientProxyConnector
Class Inheritance
Static Imports
java.nio.charset.StandardCharsets.US_ASCII, .StandardCharsets.UTF_8, java.text.MessageFormat.format

Simple HTTP proxy connector using Basic Authentication.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
private class
private class

Field Summary

Modifier and TypeField and Description
private HttpClientConnector.HttpAuthenticationHandler
private List<HttpClientConnector.HttpAuthenticationHandler>
private HttpClientConnector.HttpAuthenticationHandler
private Iterator<HttpClientConnector.HttpAuthenticationHandler>
private static final String
private static final String
private HttpClientConnector.HttpAuthenticationHandler
private boolean
Inherited from org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector:
proxyAddressproxyPasswordproxyUserremoteAddress

Constructor Summary

AccessConstructor and Description
public
HttpClientConnector(InetSocketAddress
of the proxy server we're connecting to
proxyAddress
,
InetSocketAddress
of the target server to connect to
remoteAddress
)

Creates a new HttpClientConnector.

public
HttpClientConnector(InetSocketAddress
of the proxy server we're connecting to
proxyAddress
,
InetSocketAddress
of the target server to connect to
remoteAddress
,
String
to authenticate at the proxy with
proxyUser
,
char[]
to authenticate at the proxy with
proxyPassword
)

Creates a new HttpClientConnector.

Method Summary

Modifier and TypeMethod and Description
private StringBuilder
private void
private StringBuilder
private StringBuilder
private AuthenticationChallenge
private void
public void
messageReceived(IoSession
to use for writing data
session
,
Readable
received data
buffer
)

Implements org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector.messageReceived.

Handle a received message.

private HttpClientConnector.HttpAuthenticationHandler
private void
public void
sendClientProxyMetadata(ClientSession
The ClientSession instance - Note: at this stage the client's identification line is not set yet.
sshSession
)

Implements org.apache.sshd.client.session.ClientProxyConnector.sendClientProxyMetadata.

Invoked once initial connection has been established so that the proxy can open its channel and send the meta-data to its peer.

Inherited from org.eclipse.jgit.internal.transport.sshd.proxy.AbstractClientProxyConnector:
adjustTimeoutclearPasswordgetTimeoutinitrunWhenDonesetDone

Field Detail

authenticatorback to summary
private HttpClientConnector.HttpAuthenticationHandler authenticator
availableAuthenticationsback to summary
private List<HttpClientConnector.HttpAuthenticationHandler> availableAuthentications
basicback to summary
private HttpClientConnector.HttpAuthenticationHandler basic
clientAuthenticationsback to summary
private Iterator<HttpClientConnector.HttpAuthenticationHandler> clientAuthentications
HTTP_HEADER_PROXY_AUTHENTICATIONback to summary
private static final String HTTP_HEADER_PROXY_AUTHENTICATION
HTTP_HEADER_PROXY_AUTHORIZATIONback to summary
private static final String HTTP_HEADER_PROXY_AUTHORIZATION
negotiateback to summary
private HttpClientConnector.HttpAuthenticationHandler negotiate
ongoingback to summary
private boolean ongoing

Constructor Detail

HttpClientConnectorback to summary
public HttpClientConnector(InetSocketAddress proxyAddress, InetSocketAddress remoteAddress)

Creates a new HttpClientConnector. The connector supports anonymous proxy connections as well as Basic and Negotiate authentication.

Parameters
proxyAddress:InetSocketAddress

of the proxy server we're connecting to

remoteAddress:InetSocketAddress

of the target server to connect to

HttpClientConnectorback to summary
public HttpClientConnector(InetSocketAddress proxyAddress, InetSocketAddress remoteAddress, String proxyUser, char[] proxyPassword)

Creates a new HttpClientConnector. 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:InetSocketAddress

of the proxy server we're connecting to

remoteAddress:InetSocketAddress

of the target server to connect to

proxyUser:String

to authenticate at the proxy with

proxyPassword:char[]

to authenticate at the proxy with

Method Detail

authenticateback to summary
private StringBuilder authenticate(StringBuilder msg, String token)
closeback to summary
private void close()
connectback to summary
private StringBuilder connect()
eolback to summary
private StringBuilder eol(StringBuilder msg)
getByNameback to summary
private AuthenticationChallenge getByName(List<AuthenticationChallenge> challenges, String name)
handleMessageback to summary
private void handleMessage(IoSession session, List<String> reply) throws Exception
messageReceivedback to summary
public void messageReceived(IoSession session, Readable buffer) throws Exception

Implements org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector.messageReceived.

Doc from org.eclipse.jgit.internal.transport.sshd.proxy.StatefulProxyConnector.messageReceived.

Handle a received message.

Parameters
session:IoSession

to use for writing data

buffer:Readable

received data

Annotations
@Override
Exceptions
Exception:
if data cannot be read, or the connection attempt fails
selectProtocolback to summary
private HttpClientConnector.HttpAuthenticationHandler selectProtocol(List<AuthenticationChallenge> challenges, HttpClientConnector.HttpAuthenticationHandler current) throws Exception
sendback to summary
private void send(StringBuilder msg, IoSession session) throws Exception
sendClientProxyMetadataback to summary
public void sendClientProxyMetadata(ClientSession sshSession) throws Exception

Implements org.apache.sshd.client.session.ClientProxyConnector.sendClientProxyMetadata.

Doc from org.apache.sshd.client.session.ClientProxyConnector.sendClientProxyMetadata.

Invoked once initial connection has been established so that the proxy can open its channel and send the meta-data to its peer. Upon successful return the SSH identification line is eventually sent and the protocol proceeds as usual.

Parameters
sshSession:ClientSession

The ClientSession instance - Note: at this stage the client's identification line is not set yet.

Annotations
@Override
Exceptions
Exception:
If failed to initialize the proxy - which will also terminate the session
org.eclipse.jgit.internal.transport.sshd.proxy back to summary

private Interface HttpClientConnector.HttpAuthenticationHandler

extends AuthenticationHandler<AuthenticationChallenge, String>
Known Direct Implementers
org.eclipse.jgit.internal.transport.sshd.proxy.HttpClientConnector.HttpBasicAuthentication, org.eclipse.jgit.internal.transport.sshd.proxy.HttpClientConnector.NegotiateAuthentication

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler:
closegetTokenisDoneprocesssetParamsstart

Method Detail

getNameback to summary
public String getName()
org.eclipse.jgit.internal.transport.sshd.proxy back to summary

private Class HttpClientConnector.HttpBasicAuthentication

extends BasicAuthentication<AuthenticationChallenge, String>
implements HttpAuthenticationHandler
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.internal.transport.sshd.proxy.HttpClientConnector.HttpAuthenticationHandler, org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler, java.io.Closeable, java.lang.AutoCloseable

See Also
RFC 7617

Field Summary

Modifier and TypeField and Description
private boolean
Inherited from org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication:
passworduser

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
public String
public String
Inherited from org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication:
clearPasswordcloseprocessstart

Field Detail

askedback to summary
private boolean asked

Constructor Detail

HttpBasicAuthenticationback to summary
public HttpBasicAuthentication()

Method Detail

askCredentialsback to summary
protected void askCredentials()

Overrides org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication.askCredentials.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication.askCredentials.

Asks for credentials via the global Authenticator.

Annotations
@Override
getNameback to summary
public String getName()

Implements org.eclipse.jgit.internal.transport.sshd.proxy.HttpClientConnector.HttpAuthenticationHandler.getName.

Annotations
@Override
getTokenback to summary
public String getToken() throws Exception

Implements org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.getToken.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.getToken.

Retrieves the last token generated.

Returns:String

the token, or null if there is none

Annotations
@Override
Exceptions
Exception:
if an error occurs
org.eclipse.jgit.internal.transport.sshd.proxy back to summary

private Class HttpClientConnector.NegotiateAuthentication

extends GssApiAuthentication<AuthenticationChallenge, String>
implements HttpAuthenticationHandler
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.internal.transport.sshd.proxy.HttpClientConnector.HttpAuthenticationHandler, org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler, java.io.Closeable, java.lang.AutoCloseable

See Also
RFC 4559

Field Summary

Inherited from org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication:
token

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected GSSContext
protected byte[]
extractToken(AuthenticationChallenge
to extract the token from
input
)

Implements abstract org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.extractToken.

Extracts the token from the last set parameters.

public String
public String
Inherited from org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication:
closeprocessstart

Constructor Detail

NegotiateAuthenticationback to summary
public NegotiateAuthentication()

Method Detail

createContextback to summary
protected GSSContext createContext() throws Exception

Implements abstract org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.createContext.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.createContext.

Creates the GSSContext to use.

Returns:GSSContext

a fresh GSSContext to use

Annotations
@Override
Exceptions
Exception:
if the context cannot be created
extractTokenback to summary
protected byte[] extractToken(AuthenticationChallenge input) throws Exception

Implements abstract org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.extractToken.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.GssApiAuthentication.extractToken.

Extracts the token from the last set parameters.

Parameters
input:AuthenticationChallenge

to extract the token from

Returns:byte[]

the extracted token, or null if none

Annotations
@Override
Exceptions
Exception:
if an error occurs
getNameback to summary
public String getName()

Implements org.eclipse.jgit.internal.transport.sshd.proxy.HttpClientConnector.HttpAuthenticationHandler.getName.

Annotations
@Override
getTokenback to summary
public String getToken() throws Exception

Implements org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.getToken.

Doc from org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler.getToken.

Retrieves the last token generated.

Returns:String

the token, or null if there is none

Annotations
@Override
Exceptions
Exception:
if an error occurs