Revision: 4af8d12abd8c
Author:   Jean Deruelle <[email protected]>
Date:     Sat Dec  8 14:36:54 2012
Log:      Update Issue 180

Updating code to static usage of class

http://code.google.com/p/sipservlets/source/detail?r=4af8d12abd8c

Modified:
/containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/catalina/security/authentication/DigestAuthenticator.java /containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/security/authentication/DigestAuthenticator.java

=======================================
--- /containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/catalina/security/authentication/DigestAuthenticator.java Mon Sep 24 15:05:12 2012 +++ /containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/catalina/security/authentication/DigestAuthenticator.java Sat Dec 8 14:36:54 2012
@@ -41,7 +41,6 @@
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.util.MD5Encoder;
 import org.apache.log4j.Logger;
-import org.jboss.security.SecurityConstants;
 import org.jboss.security.SecurityContext;
 import org.jboss.security.SecurityRolesAssociation;
 import org.mobicents.servlet.sip.catalina.SipLoginConfig;
@@ -73,7 +72,7 @@
     /**
      * The MD5 helper object for this class.
      */
-    static final MD5Encoder MD5_ECNODER = new MD5Encoder();
+    static final MD5Encoder MD5_ENCODER = new MD5Encoder();


     /**
@@ -281,7 +280,7 @@
         synchronized (md5Helper) {
             buffer = md5Helper.digest(a2.getBytes());
         }
-        String md5a2 = MD5_ECNODER.encode(buffer);
+        String md5a2 = MD5_ENCODER.encode(buffer);

//taken from https://github.com/jbossas/jboss-as/blob/7.1.2.Final/web/src/main/java/org/jboss/as/web/security/SecurityContextAssociationValve.java#L86
         SecurityContext sc = SecurityActions.getSecurityContext();
@@ -388,7 +387,7 @@
         synchronized (md5Helper) {
             buffer = md5Helper.digest(nOnceValue.getBytes());
         }
-        nOnceValue = MD5_ECNODER.encode(buffer);
+        nOnceValue = MD5_ENCODER.encode(buffer);

         return nOnceValue;
     }
@@ -439,7 +438,7 @@

         String authenticateHeader = "Digest realm=\"" + realmName + "\", "
             +  "qop=\"auth\", nonce=\"" + nOnce + "\", " + "opaque=\""
-            + MD5_ECNODER.encode(buffer) + "\"";
+            + MD5_ENCODER.encode(buffer) + "\"";

         // There are different headers for different types of auth
         if(response.getStatus() ==
@@ -529,7 +528,7 @@
         synchronized (md5Helper) {
             buffer = md5Helper.digest(nOnceValue.getBytes());
         }
-        String cnonce = MD5_ECNODER.encode(buffer);
+        String cnonce = MD5_ENCODER.encode(buffer);

         try {
             response = MessageDigestResponseAlgorithm.calculateResponse(
=======================================
--- /containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/security/authentication/DigestAuthenticator.java Wed Jun 6 12:51:00 2012 +++ /containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/security/authentication/DigestAuthenticator.java Sat Dec 8 14:36:54 2012
@@ -67,12 +67,6 @@

// -------------------------------------------------------------- Constants

-    /**
-     * The MD5 helper object for this class.
-     */
-    static final MD5Encoder MD5_ECNODER = new MD5Encoder();
-
-
     /**
      * Descriptive information about this implementation.
      */
@@ -276,7 +270,7 @@
         synchronized (md5Helper) {
             buffer = md5Helper.digest(a2.getBytes());
         }
-        String md5a2 = MD5_ECNODER.encode(buffer);
+        String md5a2 = MD5Encoder.encode(buffer);

return (new CatalinaSipPrincipal(realm.authenticate(userName, response, nOnce, nc, cnonce, qop,
                                    realmName, md5a2)));
@@ -363,7 +357,7 @@
         synchronized (md5Helper) {
             buffer = md5Helper.digest(nOnceValue.getBytes());
         }
-        nOnceValue = MD5_ECNODER.encode(buffer);
+        nOnceValue = MD5Encoder.encode(buffer);

         return nOnceValue;
     }
@@ -414,7 +408,7 @@

         String authenticateHeader = "Digest realm=\"" + realmName + "\", "
             +  "qop=\"auth\", nonce=\"" + nOnce + "\", " + "opaque=\""
-            + MD5_ECNODER.encode(buffer) + "\"";
+            + MD5Encoder.encode(buffer) + "\"";

         // There are different headers for different types of auth
         if(response.getStatus() ==
@@ -504,7 +498,7 @@
         synchronized (md5Helper) {
             buffer = md5Helper.digest(nOnceValue.getBytes());
         }
-        String cnonce = MD5_ECNODER.encode(buffer);
+        String cnonce = MD5Encoder.encode(buffer);

         try {
             response = MessageDigestResponseAlgorithm.calculateResponse(

Reply via email to