Author: olegk Date: Tue Jun 7 10:35:20 2005 New Revision: 188828 URL: http://svn.apache.org/viewcvs?rev=188828&view=rev Log: PR #34960 (Windows specific implementation of the Digest auth scheme)
Changed to take into account charset attribute when available (Known to be used by Microsoft implementation of the Digest auth scheme) Contributed by Oleg Kalnichevski Reviewed by Michael Becke Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java?rev=188828&r1=188827&r2=188828&view=diff ============================================================================== --- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java (original) +++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java Tue Jun 7 10:35:20 2005 @@ -267,13 +267,11 @@ "Credentials cannot be used for digest authentication: " + credentials.getClass().getName()); } - this.getParameters().put("methodname", method); - this.getParameters().put("uri", uri); + getParameters().put("methodname", method); + getParameters().put("uri", uri); String digest = createDigest( usernamepassword.getUserName(), - usernamepassword.getPassword(), - "ISO-8859-1"); - + usernamepassword.getPassword()); return "Digest " + createDigestHeader(usernamepassword.getUserName(), digest); } @@ -306,13 +304,15 @@ "Credentials cannot be used for digest authentication: " + credentials.getClass().getName()); } - this.getParameters().put("methodname", method.getName()); - this.getParameters().put("uri", method.getPath()); + getParameters().put("methodname", method.getName()); + getParameters().put("uri", method.getPath()); + String charset = getParameter("charset"); + if (charset == null) { + getParameters().put("charset", method.getParams().getCredentialCharset()); + } String digest = createDigest( usernamepassword.getUserName(), - usernamepassword.getPassword(), - method.getParams().getCredentialCharset()); - + usernamepassword.getPassword()); return "Digest " + createDigestHeader(usernamepassword.getUserName(), digest); } @@ -328,7 +328,7 @@ * value in the Authentication HTTP header. * @throws AuthenticationException when MD5 is an unsupported algorithm */ - private String createDigest(String uname, String pwd, String charset) throws AuthenticationException { + private String createDigest(final String uname, final String pwd) throws AuthenticationException { LOG.trace("enter DigestScheme.createDigest(String, String, Map)"); @@ -341,10 +341,14 @@ String qop = getParameter("qop"); String method = getParameter("methodname"); String algorithm = getParameter("algorithm"); - // If an algorithm is not specified, default to MD5. - if(algorithm == null) { - algorithm="MD5"; + if (algorithm == null) { + algorithm = "MD5"; + } + // If an charset is not specified, default to ISO-8859-1. + String charset = getParameter("charset"); + if (charset == null) { + charset = "ISO-8859-1"; } if (qopVariant == QOP_AUTH_INT) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]