Class AuthenticationBuilder
java.lang.Object
org.eclipse.aether.util.repository.AuthenticationBuilder
A utility class to build authentication info for repositories and proxies.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddCustom
(org.eclipse.aether.repository.Authentication authentication) Adds custom authentication data to the authentication.addHostnameVerifier
(HostnameVerifier verifier) Adds a hostname verifier for SSL.Adds NTLM data to the authentication.addPassword
(char[] password) Adds password data to the authentication.addPassword
(String password) Adds password data to the authentication.addPrivateKey
(String pathname, char[] passphrase) Adds private key data to the authentication.addPrivateKey
(String pathname, String passphrase) Adds private key data to the authentication.Adds sensitive custom string data to the authentication.Adds sensitive custom string data to the authentication.Adds custom string data to the authentication.addUsername
(String username) Adds username data to the authentication.org.eclipse.aether.repository.Authentication
build()
Builds a new authentication object from the current data of this builder.
-
Constructor Details
-
AuthenticationBuilder
public AuthenticationBuilder()Creates a new authentication builder.
-
-
Method Details
-
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 benull
.- Returns:
- This builder for chaining, never
null
.
-
addPassword
Adds password data to the authentication.- Parameters:
password
- The password, may benull
.- Returns:
- This builder for chaining, never
null
.
-
addPassword
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 benull
.- Returns:
- This builder for chaining, never
null
.
-
addNtlm
Adds NTLM data to the authentication.- Parameters:
workstation
- The NTLM workstation name, may benull
.domain
- The NTLM domain name, may benull
.- Returns:
- This builder for chaining, never
null
.
-
addPrivateKey
Adds private key data to the authentication.- Parameters:
pathname
- The (absolute) path to the private key file, may benull
.passphrase
- The passphrase protecting the private key, may benull
.- Returns:
- This builder for chaining, never
null
.
-
addPrivateKey
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 benull
.passphrase
- The passphrase protecting the private key, may benull
.- 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, useaddCustom(Authentication)
with a suitable implementation instead.- Parameters:
verifier
- The hostname verifier, may benull
.- Returns:
- This builder for chaining, never
null
.
-
addString
Adds custom string data to the authentication. Note: If the string data is confidential, useaddSecret(String, char[])
instead.- Parameters:
key
- The key for the authentication data, must not benull
.value
- The value for the authentication data, may benull
.- 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 benull
.value
- The value for the authentication data, may benull
.- Returns:
- This builder for chaining, never
null
.
-
addSecret
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 benull
.value
- The value for the authentication data, may benull
.- Returns:
- This builder for chaining, never
null
.
-
addCustom
Adds custom authentication data to the authentication.- Parameters:
authentication
- The authentication to add, may benull
.- Returns:
- This builder for chaining, never
null
.
-