Class 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 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 be null.
        repository - The repository whose authentication is to be fingerprinted, must not be null.
        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 be null.
        repository - The repository whose proxy authentication is to be fingerprinted, must not be null.
        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. If getProxy() is not null, 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 be null or contain null elements.
      • update

        public void update​(char... chars)
        Updates the digest with the specified characters.
        Parameters:
        chars - The characters to update the digest with, may be null.
      • update

        public void update​(byte... bytes)
        Updates the digest with the specified bytes.
        Parameters:
        bytes - The bytes to update the digest with, may be null.