Package org.eclipse.aether.repository
Class AuthenticationDigest
- java.lang.Object
-
- org.eclipse.aether.repository.AuthenticationDigest
-
public final class AuthenticationDigest extends Object
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.Proxy
getProxy()
Gets the proxy (if any) to be authenticated with.RemoteRepository
getRepository()
Gets the repository requiring authentication.RepositorySystemSession
getSession()
Gets the repository system session during which the authentication fingerprint is calculated.void
update(byte... bytes)
Updates the digest with the specified bytes.void
update(char... chars)
Updates the digest with the specified characters.void
update(String... strings)
Updates the digest with the specified strings.
-
-
-
Method Detail
-
forRepository
public static String forRepository(RepositorySystemSession session, RemoteRepository repository)
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
public static String forProxy(RepositorySystemSession session, RemoteRepository repository)
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
.
-
getSession
public RepositorySystemSession getSession()
Gets the repository system session during which the authentication fingerprint is calculated.- Returns:
- The repository system session, never
null
.
-
getRepository
public RemoteRepository 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
public Proxy getProxy()
Gets the proxy (if any) to be authenticated with.- Returns:
- The proxy or
null
if authenticating directly with the repository's host.
-
update
public void update(String... strings)
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
.
-
-