Class HttpDigestHelper


  • public class HttpDigestHelper
    extends AuthenticatorHelper
    Implements the HTTP DIGEST authentication.
    • Constructor Detail

      • HttpDigestHelper

        public HttpDigestHelper()
        Constructor.
    • Method Detail

      • isNonceValid

        public static boolean isNonceValid​(java.lang.String nonce,
                                           java.lang.String secretKey,
                                           long lifespan)
                                    throws java.lang.Exception
        Checks whether the specified nonce is valid with respect to the specified secretKey, and further confirms that the nonce was generated less than lifespanMillis milliseconds ago
        Parameters:
        nonce - The nonce value.
        secretKey - The same secret value that was inserted into the nonce when it was generated
        lifespan - The nonce lifespan in milliseconds.
        Returns:
        True if the nonce was generated less than lifespan milliseconds ago, false otherwise.
        Throws:
        java.lang.Exception - If the nonce does not match the specified secretKey, or if it can't be parsed
      • formatRequest

        public void formatRequest​(ChallengeWriter cw,
                                  ChallengeRequest challenge,
                                  Response response,
                                  Series<Header> httpHeaders)
                           throws java.io.IOException
        Description copied from class: AuthenticatorHelper
        Formats a challenge request as raw credentials.
        Overrides:
        formatRequest in class AuthenticatorHelper
        Parameters:
        cw - The header writer to update.
        challenge - The challenge request to format.
        response - The parent response.
        httpHeaders - The current request HTTP headers.
        Throws:
        java.io.IOException
      • formatResponseDigest

        public char[] formatResponseDigest​(ChallengeResponse challengeResponse,
                                           Request request)
        Formats the response digest.
        Parameters:
        challengeResponse - The challenge response.
        request - The request if available.
        Returns:
        The formatted secret of a challenge response.