Class BasicAuthentication<ParameterType,TokenType>
java.lang.Object
org.eclipse.jgit.internal.transport.sshd.auth.AbstractAuthenticationHandler<ParameterType,TokenType>
org.eclipse.jgit.internal.transport.sshd.auth.BasicAuthentication<ParameterType,TokenType>
- Type Parameters:
ParameterType
- defining the parameter type for the authenticationTokenType
- defining the token type for the authentication
- All Implemented Interfaces:
Closeable
,AutoCloseable
,AuthenticationHandler<ParameterType,
TokenType>
- Direct Known Subclasses:
HttpClientConnector.HttpBasicAuthentication
,Socks5ClientConnector.SocksBasicAuthentication
public abstract class BasicAuthentication<ParameterType,TokenType>
extends AbstractAuthenticationHandler<ParameterType,TokenType>
An abstract implementation of a username-password authentication. It can be
given an initial known username-password pair; if so, this will be tried
first. Subsequent rounds will then try to obtain a user name and password via
the global
Authenticator
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]
The current password.protected String
The current user name.Fields inherited from class org.eclipse.jgit.internal.transport.sshd.auth.AbstractAuthenticationHandler
done, params, proxy
-
Constructor Summary
ConstructorsConstructorDescriptionBasicAuthentication
(InetSocketAddress proxy, String initialUser, char[] initialPassword) Creates a newBasicAuthentication
to authenticate with the givenproxy
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Asks for credentials via the globalAuthenticator
.protected void
Clears thepassword
.final void
close()
private byte[]
convert
(char[] pass) void
process()
Produces the next authentication token, if any.final void
start()
Produces the initial authentication token that can be then retrieved viaAuthenticationHandler.getToken()
.Methods inherited from class org.eclipse.jgit.internal.transport.sshd.auth.AbstractAuthenticationHandler
isDone, setParams
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jgit.internal.transport.sshd.auth.AuthenticationHandler
getToken
-
Field Details
-
user
The current user name. -
password
protected byte[] passwordThe current password.
-
-
Constructor Details
-
BasicAuthentication
Creates a newBasicAuthentication
to authenticate with the givenproxy
.- Parameters:
proxy
-InetSocketAddress
of the proxy to connect toinitialUser
- initial user name to try; may benull
initialPassword
- initial password to try, may benull
-
-
Method Details
-
convert
private byte[] convert(char[] pass) -
clearPassword
protected void clearPassword()Clears thepassword
. -
close
public final void close() -
start
Description copied from interface:AuthenticationHandler
Produces the initial authentication token that can be then retrieved viaAuthenticationHandler.getToken()
.- Throws:
Exception
- if an error occurs
-
process
Description copied from interface:AuthenticationHandler
Produces the next authentication token, if any.- Throws:
Exception
- if an error occurs
-
askCredentials
protected void askCredentials()Asks for credentials via the globalAuthenticator
.
-