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 StringThe 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 newBasicAuthenticationto authenticate with the givenproxy. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAsks for credentials via the globalAuthenticator.protected voidClears thepassword.final voidclose()private byte[]convert(char[] pass) voidprocess()Produces the next authentication token, if any.final voidstart()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, setParamsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 newBasicAuthenticationto authenticate with the givenproxy.- Parameters:
proxy-InetSocketAddressof the proxy to connect toinitialUser- initial user name to try; may benullinitialPassword- 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:AuthenticationHandlerProduces the initial authentication token that can be then retrieved viaAuthenticationHandler.getToken().- Throws:
Exception- if an error occurs
-
process
Description copied from interface:AuthenticationHandlerProduces the next authentication token, if any.- Throws:
Exception- if an error occurs
-
askCredentials
protected void askCredentials()Asks for credentials via the globalAuthenticator.
-