cxf-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1025685&view=rev
Log:
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.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 20 19:27:49 2010
@@ -1 +1 @@
-/cxf/trunk:1025679
+/cxf/trunk:1025679,1025683

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Oct 20 19:27:49 2010
@@ -1 +1 @@
-/cxf/trunk:1-1022129,1022154,1022194,1022401-1022402,1022911,1023068,1023121,1023804,1023971-1023973,1024006,1024070,1024487,1024489,1025679
+/cxf/trunk:1-1022129,1022154,1022194,1022401-1022402,1022911,1023068,1023121,1023804,1023971-1023973,1024006,1024070,1024487,1024489,1025679,1025683

Modified: cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java?rev=1025685&r1=1025684&r2=1025685&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DigestAuthSupplier.java
Wed Oct 20 19:27:49 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