accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1450296 - /accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
Date Tue, 26 Feb 2013 17:33:39 GMT
Author: vines
Date: Tue Feb 26 17:33:39 2013
New Revision: 1450296

URL: http://svn.apache.org/r1450296
Log:
ACCUMULO-1111 - fixed infinite loops clobering the stack


Modified:
    accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java

Modified: accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java?rev=1450296&r1=1450295&r2=1450296&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
(original)
+++ accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
Tue Feb 26 17:33:39 2013
@@ -17,6 +17,7 @@
 package org.apache.accumulo.test.randomwalk.security;
 
 import java.io.IOException;
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -281,7 +282,7 @@ public class WalkingSecurity extends Sec
   public byte[] getUserPassword(String user) {
     Object obj = state.get(getSysUserName() + userPass);
     if (obj instanceof PasswordToken) {
-      return ((PasswordToken)obj).getPassword();
+      return ((PasswordToken) obj).getPassword();
     }
     return null;
   }
@@ -289,7 +290,7 @@ public class WalkingSecurity extends Sec
   public byte[] getSysPassword() {
     Object obj = state.get(getSysUserName() + userPass);
     if (obj instanceof PasswordToken) {
-      return ((PasswordToken)obj).getPassword();
+      return ((PasswordToken) obj).getPassword();
     }
     return null;
   }
@@ -372,14 +373,16 @@ public class WalkingSecurity extends Sec
       throw tse;
     }
   }
-
+  
   @Override
   public SecurityToken login(Properties properties) throws AccumuloSecurityException {
-    return authenticator.login(properties);
+    if (properties.containsKey("password"))
+      return new PasswordToken().setPassword(properties.getProperty("password").getBytes(Charset.forName("UTF-8")));
+    throw new AccumuloSecurityException(properties.getProperty("user"), SecurityErrorCode.INSUFFICIENT_PROPERTIES);
   }
-
+  
   @Override
   public boolean validTokenClass(String tokenClass) {
-    return authenticator.validTokenClass(tokenClass);
+    return tokenClass.equals(PasswordToken.class.getCanonicalName());
   }
 }



Mime
View raw message