accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1444478 - in /accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens: ./ NullToken.java PasswordToken.java SecurityToken.java
Date Sun, 10 Feb 2013 03:35:51 GMT
Author: vines
Date: Sun Feb 10 03:35:51 2013
New Revision: 1444478

URL: http://svn.apache.org/r1444478
Log:
ACCUMULO-1041 - and the corresponding other half. I miss git


Added:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/NullToken.java
  (with props)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/PasswordToken.java
  (with props)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/SecurityToken.java
  (with props)

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/NullToken.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/NullToken.java?rev=1444478&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/NullToken.java
(added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/NullToken.java
Sun Feb 10 03:35:51 2013
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.security.tokens;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import javax.security.auth.DestroyFailedException;
+
+/**
+ * 
+ */
+public class NullToken implements SecurityToken {
+  
+  @Override
+  public void readFields(DataInput arg0) throws IOException {
+    return;
+  }
+  
+  @Override
+  public void write(DataOutput arg0) throws IOException {
+    return;
+  }
+  
+  @Override
+  public void destroy() throws DestroyFailedException {
+    return;
+  }
+  
+  @Override
+  public boolean isDestroyed() {
+    return false;
+  }
+  
+  public NullToken clone() {
+    return new NullToken();
+  }
+}

Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/NullToken.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/PasswordToken.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/PasswordToken.java?rev=1444478&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/PasswordToken.java
(added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/PasswordToken.java
Sun Feb 10 03:35:51 2013
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.security.tokens;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+import javax.security.auth.DestroyFailedException;
+
+import org.apache.hadoop.io.WritableUtils;
+
+public class PasswordToken implements SecurityToken {
+  private byte[] password = null;
+  
+  public byte[] getPassword() {
+    return password;
+  }
+
+  public PasswordToken setPassword(byte[] password) {
+    this.password = password;
+    return this;
+  }
+
+  @Override
+  public void readFields(DataInput arg0) throws IOException {
+    password = WritableUtils.readCompressedByteArray(arg0);
+  }
+  
+  @Override
+  public void write(DataOutput arg0) throws IOException {
+    WritableUtils.writeCompressedByteArray(arg0, password);
+  }
+
+  @Override
+  public void destroy() throws DestroyFailedException {
+    Arrays.fill(password, (byte)0x00);
+    password = null;
+  }
+
+  @Override
+  public boolean isDestroyed() {
+    return password==null;
+  }
+
+  @Override
+  public int hashCode() {
+    return Arrays.hashCode(password);
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj)
+      return true;
+    if (obj == null)
+      return false;
+    if (!(obj instanceof PasswordToken))
+      return false;
+    PasswordToken other = (PasswordToken) obj;
+    if (!Arrays.equals(password, other.password))
+      return false;
+    return true;
+  }
+  
+  public PasswordToken clone() {
+    return new PasswordToken().setPassword(Arrays.copyOf(password, password.length));
+  }
+}

Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/PasswordToken.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/SecurityToken.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/SecurityToken.java?rev=1444478&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/SecurityToken.java
(added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/SecurityToken.java
Sun Feb 10 03:35:51 2013
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.security.tokens;
+
+import javax.security.auth.Destroyable;
+
+import org.apache.hadoop.io.Writable;
+
+public interface SecurityToken extends Writable, Destroyable, Cloneable {
+  public SecurityToken clone();
+}

Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/SecurityToken.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message