Package org.eclipse.aether.repository
Class AuthenticationDigest
java.lang.Object
org.eclipse.aether.repository.AuthenticationDigest
A helper to calculate a fingerprint/digest for the authentication data of a repository/proxy. Such a fingerprint can
be used to detect changes in the authentication data across JVM restarts without exposing sensitive information.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MessageDigest
private final Proxy
private final RemoteRepository
private final RepositorySystemSession
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
AuthenticationDigest
(RepositorySystemSession session, RemoteRepository repository, Proxy proxy) -
Method Summary
Modifier and TypeMethodDescriptionprivate String
digest()
static String
forProxy
(RepositorySystemSession session, RemoteRepository repository) Gets the fingerprint for the authentication of the specified repository's proxy.static String
forRepository
(RepositorySystemSession session, RemoteRepository repository) Gets the fingerprint for the authentication of the specified repository.getProxy()
Gets the proxy (if any) to be authenticated with.Gets the repository requiring authentication.Gets the repository system session during which the authentication fingerprint is calculated.private static MessageDigest
void
update
(byte... bytes) Updates the digest with the specified bytes.void
update
(char... chars) Updates the digest with the specified characters.void
Updates the digest with the specified strings.
-
Field Details
-
digest
-
session
-
repository
-
proxy
-
-
Constructor Details
-
AuthenticationDigest
private AuthenticationDigest(RepositorySystemSession session, RemoteRepository repository, Proxy proxy)
-
-
Method Details
-
forRepository
Gets the fingerprint for the authentication of the specified repository.- Parameters:
session
- The repository system session during which the fingerprint is requested, must not benull
.repository
- The repository whose authentication is to be fingerprinted, must not benull
.- Returns:
- The fingerprint of the repository authentication or an empty string if no authentication is configured,
never
null
.
-
forProxy
Gets the fingerprint for the authentication of the specified repository's proxy.- Parameters:
session
- The repository system session during which the fingerprint is requested, must not benull
.repository
- The repository whose proxy authentication is to be fingerprinted, must not benull
.- Returns:
- The fingerprint of the proxy authentication or an empty string if no proxy is present or if no proxy
authentication is configured, never
null
.
-
newDigest
-
getSession
Gets the repository system session during which the authentication fingerprint is calculated.- Returns:
- The repository system session, never
null
.
-
getRepository
Gets the repository requiring authentication. IfgetProxy()
is notnull
, the data gathered by this authentication digest does not apply to the repository's host but rather the proxy.- Returns:
- The repository to be contacted, never
null
.
-
getProxy
Gets the proxy (if any) to be authenticated with.- Returns:
- The proxy or
null
if authenticating directly with the repository's host.
-
update
Updates the digest with the specified strings.- Parameters:
strings
- The strings to update the digest with, may benull
or containnull
elements.
-
update
public void update(char... chars) Updates the digest with the specified characters.- Parameters:
chars
- The characters to update the digest with, may benull
.
-
update
public void update(byte... bytes) Updates the digest with the specified bytes.- Parameters:
bytes
- The bytes to update the digest with, may benull
.
-
digest
-