cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1025694 - in /cxf/branches/2.2.x-fixes: ./ rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java
Date Wed, 20 Oct 2010 19:32:34 GMT
Author: dkulp
Date: Wed Oct 20 19:32:33 2010
New Revision: 1025694

URL: http://svn.apache.org/viewvc?rev=1025694&view=rev
Log:
Merged revisions 1025685 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.3.x-fixes

................
  r1025685 | dkulp | 2010-10-20 15:27:49 -0400 (Wed, 20 Oct 2010) | 9 lines
  
  Merged revisions 1025683 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1025683 | dkulp | 2010-10-20 15:25:45 -0400 (Wed, 20 Oct 2010) | 1 line
    
    [CXF-3073] Switch to instance var for md5 digest and sync it properly
  ........
................

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java?rev=1025694&r1=1025693&r2=1025694&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java
Wed Oct 20 19:32:33 2010
@@ -40,19 +40,21 @@ public class DigestAuthSupplier extends 
     private static final char[] HEXADECIMAL = {
         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
     };
-    private static final MessageDigest MD5_HELPER;
-    static {
+
+    final MessageDigest md5Helper;
+    Map<URL, DigestInfo> authInfo = new ConcurrentHashMap<URL, DigestInfo>();

+
+    public DigestAuthSupplier() {
         MessageDigest md = null;
         try {
             md = MessageDigest.getInstance("MD5");
         } catch (NoSuchAlgorithmException e) {
             md = null;
         }
-        MD5_HELPER = md;
+        md5Helper = md;
     }
-
-    Map<URL, DigestInfo> authInfo = new ConcurrentHashMap<URL, DigestInfo>();

-
+    
+    
     /**
      * {@inheritDoc}
      * With digest, the nonce could expire and thus a rechallenge will be issued.
@@ -243,9 +245,13 @@ public class DigestAuthSupplier extends 
         
     }
 
-    public static String createCnonce() throws UnsupportedEncodingException {
+    public String createCnonce() throws UnsupportedEncodingException {
         String cnonce = Long.toString(System.currentTimeMillis());
-        return encode(MD5_HELPER.digest(cnonce.getBytes("US-ASCII")));
+        byte[] bytes = cnonce.getBytes("US-ASCII");
+        synchronized (md5Helper) {
+            bytes = md5Helper.digest(bytes);
+        }
+        return encode(bytes);
     }
 
     /**



Mime
View raw message