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>
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 globalAuthenticator
.
-
-
Constructor Summary
Constructors Constructor Description BasicAuthentication(InetSocketAddress proxy, String initialUser, char[] initialPassword)
Creates a newBasicAuthentication
to authenticate with the givenproxy
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
askCredentials()
Asks for credentials via the globalAuthenticator
.protected void
clearPassword()
Clears thepassword
.void
close()
void
process()
Produces the next authentication token, if any.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 Detail
-
user
protected String user
The current user name.
-
password
protected byte[] password
The current password.
-
-
Constructor Detail
-
BasicAuthentication
public BasicAuthentication(InetSocketAddress proxy, String initialUser, char[] initialPassword)
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 Detail
-
clearPassword
protected void clearPassword()
Clears thepassword
.
-
close
public final void close()
-
start
public final void start() throws Exception
Description copied from interface:AuthenticationHandler
Produces the initial authentication token that can be then retrieved viaAuthenticationHandler.getToken()
.- Throws:
Exception
- if an error occurs
-
process
public void process() throws Exception
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
.
-
-