Class DigestAuthClientCredentials

java.lang.Object
com.helger.http.digestauth.DigestAuthClientCredentials

@Immutable public class DigestAuthClientCredentials extends Object
Credentials for HTTP digest authentication
Author:
Philip Helger
  • Field Details

    • EXPECTED_RESPONSE_LENGTH

      public static final int EXPECTED_RESPONSE_LENGTH
      Expected response length for MD5 algorithms (32 hex chars).
      See Also:
    • EXPECTED_SHA256_RESPONSE_LENGTH

      public static final int EXPECTED_SHA256_RESPONSE_LENGTH
      Expected response length for SHA-256 algorithms (64 hex chars). @since 12.2.0
      See Also:
    • EXPECTED_NONCE_COUNT_LENGTH

      public static final int EXPECTED_NONCE_COUNT_LENGTH
      See Also:
  • Constructor Details

    • DigestAuthClientCredentials

      public DigestAuthClientCredentials(@Nonempty @NonNull @Nonempty String sUserName, @Nonempty @NonNull @Nonempty String sRealm, @Nonempty @NonNull @Nonempty String sServerNonce, @Nonempty @NonNull @Nonempty String sDigestURI, @Nonempty @NonNull @Nonempty String sResponse, @Nullable String sAlgorithm, @Nullable String sClientNonce, @Nullable String sOpaque, @Nullable String sMessageQOP, @Nullable String sNonceCount)
      Constructor with all digest authentication parameters.
      Parameters:
      sUserName - The user name. May neither be null nor empty.
      sRealm - The realm. May neither be null nor empty.
      sServerNonce - The server nonce. May neither be null nor empty.
      sDigestURI - The digest URI. May neither be null nor empty.
      sResponse - The response hash. May neither be null nor empty. Must be a 32-character lowercase hex string.
      sAlgorithm - The algorithm used. May be null.
      sClientNonce - The client nonce. May be null.
      sOpaque - The opaque value. May be null.
      sMessageQOP - The quality of protection. May be null.
      sNonceCount - The nonce count as an 8-character hex string. May be null.
  • Method Details

    • getUserName

      @Nonempty public @NonNull @Nonempty String getUserName()
      Returns:
      The user name. Neither null nor empty.
    • getRealm

      @Nonempty public @NonNull @Nonempty String getRealm()
      Returns:
      The realm. Neither null nor empty.
    • getServerNonce

      @Nonempty public @NonNull @Nonempty String getServerNonce()
      Returns:
      The nonce. Neither null nor empty.
    • getDigestURI

      @Nonempty public @NonNull @Nonempty String getDigestURI()
      Returns:
      The digest URI. Neither null nor empty.
    • getResponse

      public @Nullable String getResponse()
      Returns:
      The response hash value. May be null.
    • getAlgorithm

      public @Nullable String getAlgorithm()
      Returns:
      The algorithm used. May be null.
    • getClientNonce

      public @Nullable String getClientNonce()
      Returns:
      The client nonce. May be null.
    • getOpaque

      public @Nullable String getOpaque()
      Returns:
      The opaque value. May be null.
    • getMessageQOP

      public @Nullable String getMessageQOP()
      Returns:
      The message quality of protection. May be null.
    • getNonceCount

      @CheckForSigned public int getNonceCount()
      Returns:
      The nonce count value. Returns -1 if not set.
    • getRequestValue

      @Nonempty public @NonNull @Nonempty String getRequestValue()
      Returns:
      The complete Digest authentication request header value. Neither null nor empty.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object