code: public static String createAuthenticateHeader(final String realm, final String authMethod, final String nonce) {
          val stringBuilder = new StringBuilder("Digest realm=\"")
              .append(realm).append("\",");
          if (StringUtils.isNotBlank(authMethod)) {
              stringBuilder.append("qop=").append(authMethod).append(',');
          }
          return stringBuilder.append("nonce=\"").append(nonce)
              .append("\",opaque=\"").append(createOpaque(realm, nonce))
              .append('"')
              .toString();
      }
docs: Create authenticate header, containing the realm, nonce, opaque, etc.
  
  @param realm      the realm
  @param authMethod the auth method
  @param nonce      the nonce
  @return the header string