web/src/main/java/org/springframework/security/web/authentication/www/DigestAuthUtils.java
static String generateDigest(boolean passwordAlreadyEncoded, String username,
			String realm, String password, String httpMethod, String uri, String qop,
			String nonce, String nc, String cnonce) throws IllegalArgumentException {
		String a1Md5;
		String a2 = httpMethod + ":" + uri;
		String a2Md5 = md5Hex(a2);

		if (passwordAlreadyEncoded) {
			a1Md5 = password;
		}
		else {
			a1Md5 = DigestAuthUtils.encodePasswordInA1Format(username, realm, password);
		}

		String digest;

		if (qop == null) {
			// as per RFC 2069 compliant clients (also reaffirmed by RFC 2617)
			digest = a1Md5 + ":" + nonce + ":" + a2Md5;
		}
		else if ("auth".equals(qop)) {
			// As per RFC 2617 compliant clients
			digest = a1Md5 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":"
					+ a2Md5;
		}
		else {
			throw new IllegalArgumentException("This method does not support a qop: '"
					+ qop + "'");
		}

		return md5Hex(digest);
	}
static String generateDigest(boolean passwordAlreadyEncoded, String username,
			String realm, String password, String httpMethod, String uri, String qop,
			String nonce, String nc, String cnonce) throws IllegalArgumentException {
		String a1Md5;
		String a2 = httpMethod + ":" + uri;
		String a2Md5 = md5Hex(a2);

		if (passwordAlreadyEncoded) {
			a1Md5 = password;
		}
		else {
			a1Md5 = DigestAuthUtils.encodePasswordInA1Format(username, realm, password);
		}

		String digest;

		if (qop == null) {
			// as per RFC 2069 compliant clients (also reaffirmed by RFC 2617)
			digest = a1Md5 + ":" + nonce + ":" + a2Md5;
		}
		else if ("auth".equals(qop)) {
			// As per RFC 2617 compliant clients
			digest = a1Md5 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":"
					+ a2Md5;
		}
		else {
			throw new IllegalArgumentException("This method does not support a qop: '"
					+ qop + "'");
		}

		return md5Hex(digest);
	}
static String generateDigest ( boolean passwordAlreadyEncoded , String username , String realm , String password , String httpMethod , String uri , String qop , String nonce , String nc , String cnonce ) throws IllegalArgumentException { String a1Md5 ; String a2 = httpMethod + ":" + uri ; String a2Md5 = md5Hex ( a2 ) ; if ( passwordAlreadyEncoded ) { a1Md5 = password ; } else { a1Md5 = DigestAuthUtils . encodePasswordInA1Format ( username , realm , password ) ; } String digest ; if ( qop == null ) { // as per RFC 2069 compliant clients (also reaffirmed by RFC 2617) digest = a1Md5 + ":" + nonce + ":" + a2Md5 ; } else if ( "auth" . equals ( qop ) ) { // As per RFC 2617 compliant clients digest = a1Md5 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + a2Md5 ; } else { throw new IllegalArgumentException ( "This method does not support a qop: '" + qop + "'" ) ; } return md5Hex ( digest ) ; }
Computes the <code>response</code> portion of a Digest authentication header. Both
the server and user agent should compute the <code>response</code> independently.
Provided as a static method to simplify the coding of user agents.

@param passwordAlreadyEncoded true if the password argument is already encoded in
the correct format. False if it is plain text.
@param username the user's login name.
@param realm the name of the realm.
@param password the user's password in plaintext or ready-encoded.
@param httpMethod the HTTP request method (GET, POST etc.)
@param uri the request URI.
@param qop the qop directive, or null if not set.
@param nonce the nonce supplied by the server
@param nc the "nonce-count" as defined in RFC 2617.
@param cnonce opaque string supplied by the client when qop is set.
@return the MD5 of the digest authentication response, encoded in hex
@throws IllegalArgumentException if the supplied qop value is unsupported.
Computes the <code > response< / code > portion of a Digest authentication header . Both the server and user agent should compute the <code > response< / code > independently . Provided as a static method to simplify the coding of user agents .