Class AuthenticationBuilder

java.lang.Object
org.eclipse.aether.util.repository.AuthenticationBuilder

public final class AuthenticationBuilder extends Object
A utility class to build authentication info for repositories and proxies.
  • Constructor Details

  • Method Details

    • build

      public org.eclipse.aether.repository.Authentication build()
      Builds a new authentication object from the current data of this builder. The state of the builder itself remains unchanged.
      Returns:
      The authentication or null if no authentication data was supplied to the builder.
    • addUsername

      Adds username data to the authentication.
      Parameters:
      username - The username, may be null.
      Returns:
      This builder for chaining, never null.
    • addPassword

      Adds password data to the authentication.
      Parameters:
      password - The password, may be null.
      Returns:
      This builder for chaining, never null.
    • addPassword

      public AuthenticationBuilder addPassword(char[] password)
      Adds password data to the authentication. The resulting authentication object uses an encrypted copy of the supplied character data and callers are advised to clear the input array soon after this method returns.
      Parameters:
      password - The password, may be null.
      Returns:
      This builder for chaining, never null.
    • addNtlm

      public AuthenticationBuilder addNtlm(String workstation, String domain)
      Adds NTLM data to the authentication.
      Parameters:
      workstation - The NTLM workstation name, may be null.
      domain - The NTLM domain name, may be null.
      Returns:
      This builder for chaining, never null.
    • addPrivateKey

      public AuthenticationBuilder addPrivateKey(String pathname, String passphrase)
      Adds private key data to the authentication.
      Parameters:
      pathname - The (absolute) path to the private key file, may be null.
      passphrase - The passphrase protecting the private key, may be null.
      Returns:
      This builder for chaining, never null.
    • addPrivateKey

      public AuthenticationBuilder addPrivateKey(String pathname, char[] passphrase)
      Adds private key data to the authentication. The resulting authentication object uses an encrypted copy of the supplied character data and callers are advised to clear the input array soon after this method returns.
      Parameters:
      pathname - The (absolute) path to the private key file, may be null.
      passphrase - The passphrase protecting the private key, may be null.
      Returns:
      This builder for chaining, never null.
    • addHostnameVerifier

      Adds a hostname verifier for SSL. Note: This method assumes that all possible instances of the verifier's runtime type exhibit the exact same behavior, i.e. the behavior of the verifier depends solely on the runtime type and not on any configuration. For verifiers that do not fit this assumption, use addCustom(Authentication) with a suitable implementation instead.
      Parameters:
      verifier - The hostname verifier, may be null.
      Returns:
      This builder for chaining, never null.
    • addString

      Adds custom string data to the authentication. Note: If the string data is confidential, use addSecret(String, char[]) instead.
      Parameters:
      key - The key for the authentication data, must not be null.
      value - The value for the authentication data, may be null.
      Returns:
      This builder for chaining, never null.
    • addSecret

      Adds sensitive custom string data to the authentication.
      Parameters:
      key - The key for the authentication data, must not be null.
      value - The value for the authentication data, may be null.
      Returns:
      This builder for chaining, never null.
    • addSecret

      public AuthenticationBuilder addSecret(String key, char[] value)
      Adds sensitive custom string data to the authentication. The resulting authentication object uses an encrypted copy of the supplied character data and callers are advised to clear the input array soon after this method returns.
      Parameters:
      key - The key for the authentication data, must not be null.
      value - The value for the authentication data, may be null.
      Returns:
      This builder for chaining, never null.
    • addCustom

      public AuthenticationBuilder addCustom(org.eclipse.aether.repository.Authentication authentication)
      Adds custom authentication data to the authentication.
      Parameters:
      authentication - The authentication to add, may be null.
      Returns:
      This builder for chaining, never null.