in sdk/core/azure-core-http/src/main/java/com/azure/android/core/http/util/AuthorizationChallengeHandler.java [479:511]
private static String buildAuthorizationHeader(String username, String realm, String uri, String algorithm,
String nonce, int nc, String cnonce, String qop, String response, String opaque, boolean userhash) {
StringBuilder authorizationBuilder = new StringBuilder(DIGEST);
authorizationBuilder.append("username=\"").append(username).append("\", ")
.append("realm=\"").append(realm).append("\", ")
.append("nonce=\"").append(nonce).append("\", ")
.append("uri=\"").append(uri).append("\", ")
.append("response=\"").append(response).append("\"");
if (algorithm != null && algorithm.length() != 0) {
authorizationBuilder.append(", ").append("algorithm=").append(algorithm);
}
if (cnonce != null && cnonce.length() != 0) {
authorizationBuilder.append(", ").append("cnonce=\"").append(cnonce).append("\"");
}
if (opaque != null && opaque.length() != 0) {
authorizationBuilder.append(", ").append("opaque=\"").append(opaque).append("\"");
}
if (qop != null && qop.length() != 0) {
authorizationBuilder.append(", ").append("qop=").append(qop);
authorizationBuilder.append(", ").append("nc=").append(String.format("%08X", nc));
}
if (userhash) {
authorizationBuilder.append(", ").append("userhash=").append(true);
}
return authorizationBuilder.toString();
}