org.eclipse.aether.util.repository

## 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 Summary

    Constructors
    Constructor and Description
    `AuthenticationBuilder()` Creates a new authentication builder.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `AuthenticationBuilder` | `addCustom(Authentication authentication)` Adds custom authentication data to the authentication.
    `AuthenticationBuilder` | `addHostnameVerifier(HostnameVerifier verifier)` Adds a hostname verifier for SSL.
    `AuthenticationBuilder` | `addNtlm(String workstation, String domain)` Adds NTLM data to the authentication.
    `AuthenticationBuilder` | `addPassword(char[] password)` Adds password data to the authentication.
    `AuthenticationBuilder` | `addPassword(String password)` Adds password data to the authentication.
    `AuthenticationBuilder` | `addPrivateKey(String pathname, char[] passphrase)` Adds private key data to the authentication.
    `AuthenticationBuilder` | `addPrivateKey(String pathname, String passphrase)` Adds private key data to the authentication.
    `AuthenticationBuilder` | `addSecret(String key, char[] value)` Adds sensitive custom string data to the authentication.
    `AuthenticationBuilder` | `addSecret(String key, String value)` Adds sensitive custom string data to the authentication.
    `AuthenticationBuilder` | `addString(String key, String value)` Adds custom string data to the authentication.
    `AuthenticationBuilder` | `addUsername(String username)` Adds username data to the authentication.
    `Authentication` | `build()` Builds a new authentication object from the current data of this builder.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AuthenticationBuilder

          public AuthenticationBuilder()

      Creates a new authentication builder.

  - ### Method Detail

    - #### build

          public 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

          public AuthenticationBuilder addUsername(String username)

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

    - #### addPassword

          public AuthenticationBuilder addPassword(String password)

      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

          public AuthenticationBuilder addHostnameVerifier(HostnameVerifier verifier)

      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

          public AuthenticationBuilder addString(String key,
                                        String value)

      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

          public AuthenticationBuilder addSecret(String key,
                                        String value)

      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(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`.

Copyright © 2010-2013 The Eclipse Foundation. All Rights Reserved.