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 authentication
TokenType - 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 Details

    • user

      protected String user
      The current user name.
    • password

      protected byte[] password
      The current password.
  • Constructor Details

    • BasicAuthentication

      public BasicAuthentication(InetSocketAddress proxy, String initialUser, char[] initialPassword)
      Creates a new BasicAuthentication to authenticate with the given proxy.
      Parameters:
      proxy - InetSocketAddress of the proxy to connect to
      initialUser - initial user name to try; may be null
      initialPassword - initial password to try, may be null
  • Method Details

    • convert

      private byte[] convert(char[] pass)
    • clearPassword

      protected void clearPassword()
      Clears the password.
    • 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 via AuthenticationHandler.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 global Authenticator.