]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1402 removed double b64 encoding in test and double b64 decoding from the...
authorSanjay Dalal <sanjay.dalal@berkeley.edu>
Tue, 6 Apr 2010 19:32:11 +0000 (19:32 +0000)
committerSanjay Dalal <sanjay.dalal@berkeley.edu>
Tue, 6 Apr 2010 19:32:11 +0000 (19:32 +0000)
test: account tests

M    account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java
M    account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java

services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java
services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java

index c5b510e2f54d4898b2f11456d353d1f0a140a22c..3c5f92d9770cee2efea04f84ff6f3cf0c5cf0711 100644 (file)
@@ -874,7 +874,6 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
 
     }
 
-
     // ---------------------------------------------------------------
     // Utility methods used by tests above
     // ---------------------------------------------------------------
@@ -902,8 +901,19 @@ public class AccountServiceTest extends AbstractServiceTestImpl {
             account.setUserId(userName);
         }
         if (usePassword) {
-            account.setPassword(Base64.encodeBase64(passwd.getBytes()));
+            //jaxb marshaller already b64 encodes the xs:base64Binary types
+            //no need to double encode
+//            byte[] b64pass = Base64.encodeBase64(passwd.getBytes());
+//            account.setPassword(b64pass);
+            if (logger.isDebugEnabled()) {
+                logger.debug("user=" + userName + " password=" + passwd
+                        + " password length=" + passwd.getBytes().length);
+//
+            }
+            //jaxb encodes password too
+            account.setPassword(passwd.getBytes());
         }
+
         account.setPersonRefName(screenName);
         account.setEmail(email);
         account.setPhone("1234567890");
index 68b9545f72f5d6206a2390ade6dffccd8f154ec1..db960b1a489cb6219332b8dd20d7e73fc9239b8d 100644 (file)
@@ -320,10 +320,11 @@ public class AccountStorageClient extends JpaStorageClientImpl {
     }
 
     private String getEncPassword(AccountsCommon account) {
-        byte[] bpass = Base64.decodeBase64(account.getPassword());
-        SecurityUtils.validatePassword(new String(bpass));
+        //jaxb unmarshaller already unmarshal xs:base64Binary, no need to b64 decode
+        //byte[] bpass = Base64.decodeBase64(account.getPassword());
+        SecurityUtils.validatePassword(new String(account.getPassword()));
         String secEncPasswd = SecurityUtils.createPasswordHash(
-                account.getUserId(), new String(bpass));
+                account.getUserId(), new String(account.getPassword()));
         return secEncPasswd;
     }