code: public static String getDirectiveValue(
              HashMap<String, String> directivesMap, String directive,
              boolean mandatory) throws AuthenticationException {
          String value = directivesMap.get(directive);
          if (value == null) {
              if (mandatory) {
                  throw new AuthenticationException("\"" + directive
                          + "\" mandatory directive is missing");
              }
  
              return "";
          }
  
          return value;
      }
docs: A directive is a parameter of the digest authentication process.
  Returns the value of a directive from the map. If mandatory is true and the
  value is null, then it throws an {@link AuthenticationException}.
  
  @param directivesMap the directive's map
  @param directive the name of the directive we want to retrieve
  @param mandatory is the directive mandatory
  @return the mandatory value as a String
  @throws AuthenticationException if mandatory is true and if
  directivesMap.get(directive) == null