Author: slebresne Date: Fri Oct 7 15:29:22 2011 New Revision: 1180076 URL: http://svn.apache.org/viewvc?rev=1180076&view=rev Log: Move SimpleAuthenticator and SimpleAuthority to examples/ patch by slebresne; reviewed by jbellis for CASSANDRA-2922
Added: cassandra/branches/cassandra-1.0.0/examples/simple_authentication/ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/README.txt cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/access.properties cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/passwd.properties cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java Removed: cassandra/branches/cassandra-1.0.0/conf/access.properties cassandra/branches/cassandra-1.0.0/conf/passwd.properties cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/auth/SimpleAuthority.java cassandra/branches/cassandra-1.0.0/test/unit/org/apache/cassandra/auth/SimpleAuthorityTest.java Modified: cassandra/branches/cassandra-1.0.0/CHANGES.txt cassandra/branches/cassandra-1.0.0/NEWS.txt cassandra/branches/cassandra-1.0.0/conf/README.txt cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/auth/IAuthenticator.java cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliMain.java cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyOutputFormat.java cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java Modified: cassandra/branches/cassandra-1.0.0/CHANGES.txt URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/CHANGES.txt?rev=1180076&r1=1180075&r2=1180076&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0.0/CHANGES.txt (original) +++ cassandra/branches/cassandra-1.0.0/CHANGES.txt Fri Oct 7 15:29:22 2011 @@ -24,6 +24,7 @@ Fixes merged from 0.8 below: * Fix missing fields in CLI `show schema` output (CASSANDRA-3304) * Nodetool no longer leaks threads and closes JMX connections (CASSANDRA-3309) * fix truncate allowing data to be replayed post-restart (CASSANDRA-3297) + * Move SimpleAuthority and SimpleAuthenticator to examples (CASSANDRA-2922) 1.0.0-rc2 Modified: cassandra/branches/cassandra-1.0.0/NEWS.txt URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/NEWS.txt?rev=1180076&r1=1180075&r2=1180076&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0.0/NEWS.txt (original) +++ cassandra/branches/cassandra-1.0.0/NEWS.txt Fri Oct 7 15:29:22 2011 @@ -22,6 +22,10 @@ Upgrading - Cassandra 1.0 uses arena allocation to reduce old generation fragmentation. This means there is a minimum overhead of 1MB per ColumnFamily plus 1MB per index. + - The SimpleAuthenticator and SimpleAuthority classes have been moved to + the example directory (and are thus not available from the binary + distribution). They never provided actual security and in their current + state are only meant as examples. Features -------- Modified: cassandra/branches/cassandra-1.0.0/conf/README.txt URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/conf/README.txt?rev=1180076&r1=1180075&r2=1180076&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0.0/conf/README.txt (original) +++ cassandra/branches/cassandra-1.0.0/conf/README.txt Fri Oct 7 15:29:22 2011 @@ -8,6 +8,4 @@ log4j-server.proprties: log4j configurat Optional configuration files ============================ -access.properties: used for authorization -passwd.properties: used for authentication cassandra-topology.properties: used by PropertyFileSnitch Added: cassandra/branches/cassandra-1.0.0/examples/simple_authentication/README.txt URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/examples/simple_authentication/README.txt?rev=1180076&view=auto ============================================================================== --- cassandra/branches/cassandra-1.0.0/examples/simple_authentication/README.txt (added) +++ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/README.txt Fri Oct 7 15:29:22 2011 @@ -0,0 +1,14 @@ +The files in this directory provide a (simplistic) example of how to add +authentication and resource permissions to Cassandra by implementing the +org.apache.cassandra.auth.{IAuthenticator, IAuthority} interfaces. + +To try those examples, copy the two JAVA sources (in src/) into the main +cassandra sources directory and the two configuration files (in conf/) in the +main cassandra configuration directory. + +You can then set the authenticator and authority properties in cassandra.yaml +to use those classes. See the two configuration files access.properties and +passwd.properties to configure the authorized users and permissions. + +Please note that the code in this directory is for demonstration purposes. In +particular, it does not provide a high level of security. Added: cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/access.properties URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/access.properties?rev=1180076&view=auto ============================================================================== --- cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/access.properties (added) +++ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/access.properties Fri Oct 7 15:29:22 2011 @@ -0,0 +1,39 @@ +# 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. + +# This is a sample access file for SimpleAuthority. The format of this file +# is KEYSPACE[.COLUMNFAMILY].PERMISSION=USERS, where: +# +# * KEYSPACE is the keyspace name. +# * COLUMNFAMILY is the column family name. +# * PERMISSION is one of <ro> or <rw> for read-only or read-write respectively. +# * USERS is a comma delimited list of users from passwd.properties. +# +# See below for example entries. + +# NOTE: This file contains potentially sensitive information, please keep +# this in mind when setting its mode and ownership. + +# The magical '<modify-keyspaces>' property lists users who can modify the +# list of keyspaces: all users will be able to view the list of keyspaces. +<modify-keyspaces>=jsmith + +# Access to Keyspace1 (add/remove column families, etc). +Keyspace1.<ro>=jsmith,Elvis Presley +Keyspace1.<rw>=dilbert + +# Access to Standard1 (keyspace Keyspace1) +Keyspace1.Standard1.<rw>=jsmith,Elvis Presley,dilbert Added: cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/passwd.properties URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/passwd.properties?rev=1180076&view=auto ============================================================================== --- cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/passwd.properties (added) +++ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/conf/passwd.properties Fri Oct 7 15:29:22 2011 @@ -0,0 +1,23 @@ +# 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. +# +# This is a sample password file for SimpleAuthenticator. The format of +# this file is username=password. If -Dpasswd.mode=MD5 then the password +# is represented as an md5 digest, otherwise it is cleartext (keep this +# in mind when setting file mode and ownership). +jsmith=havebadpass +Elvis\ Presley=graceland4evar +dilbert=nomoovertime Added: cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java?rev=1180076&view=auto ============================================================================== --- cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java (added) +++ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthenticator.java Fri Oct 7 15:29:22 2011 @@ -0,0 +1,149 @@ +package org.apache.cassandra.auth; +/* + * + * 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. + * + */ + + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.MessageDigest; +import java.util.Map; +import java.util.Properties; + +import org.apache.cassandra.config.ConfigurationException; +import org.apache.cassandra.io.util.FileUtils; +import org.apache.cassandra.thrift.AuthenticationException; +import org.apache.cassandra.utils.FBUtilities; + +public class SimpleAuthenticator implements IAuthenticator +{ + public final static String PASSWD_FILENAME_PROPERTY = "passwd.properties"; + public final static String PMODE_PROPERTY = "passwd.mode"; + public static final String USERNAME_KEY = "username"; + public static final String PASSWORD_KEY = "password"; + + public enum PasswordMode + { + PLAIN, MD5, + }; + + public AuthenticatedUser defaultUser() + { + // users must log in + return null; + } + + public AuthenticatedUser authenticate(Map<? extends CharSequence,? extends CharSequence> credentials) throws AuthenticationException + { + String pmode_plain = System.getProperty(PMODE_PROPERTY); + PasswordMode mode = PasswordMode.PLAIN; + + if (null != pmode_plain) + { + try + { + mode = PasswordMode.valueOf(pmode_plain); + } + catch (Exception e) + { + // this is not worth a StringBuffer + String mode_values = ""; + for (PasswordMode pm : PasswordMode.values()) + mode_values += "'" + pm + "', "; + + mode_values += "or leave it unspecified."; + throw new AuthenticationException("The requested password check mode '" + pmode_plain + "' is not a valid mode. Possible values are " + mode_values); + } + } + + String pfilename = System.getProperty(PASSWD_FILENAME_PROPERTY); + + String username = null; + CharSequence user = credentials.get(USERNAME_KEY); + if (null == user) + throw new AuthenticationException("Authentication request was missing the required key '" + USERNAME_KEY + "'"); + else + username = user.toString(); + + String password = null; + CharSequence pass = credentials.get(PASSWORD_KEY); + if (null == pass) + throw new AuthenticationException("Authentication request was missing the required key '" + PASSWORD_KEY + "'"); + else + password = pass.toString(); + + boolean authenticated = false; + + InputStream in = null; + try + { + in = new BufferedInputStream(new FileInputStream(pfilename)); + Properties props = new Properties(); + props.load(in); + + // note we keep the message here and for the wrong password exactly the same to prevent attackers from guessing what users are valid + if (null == props.getProperty(username)) throw new AuthenticationException(authenticationErrorMessage(mode, username)); + switch (mode) + { + case PLAIN: + authenticated = password.equals(props.getProperty(username)); + break; + case MD5: + authenticated = MessageDigest.isEqual(FBUtilities.threadLocalMD5Digest().digest(password.getBytes()), FBUtilities.hexToBytes(props.getProperty(username))); + break; + default: + throw new RuntimeException("Unknown PasswordMode " + mode); + } + } + catch (IOException e) + { + throw new RuntimeException("Authentication table file given by property " + PASSWD_FILENAME_PROPERTY + " could not be opened: " + e.getMessage()); + } + catch (Exception e) + { + throw new RuntimeException("Unexpected authentication problem", e); + } + finally + { + FileUtils.closeQuietly(in); + } + + if (!authenticated) throw new AuthenticationException(authenticationErrorMessage(mode, username)); + + return new AuthenticatedUser(username); + } + + public void validateConfiguration() throws ConfigurationException + { + String pfilename = System.getProperty(SimpleAuthenticator.PASSWD_FILENAME_PROPERTY); + if (pfilename == null) + { + throw new ConfigurationException("When using " + this.getClass().getCanonicalName() + " " + + SimpleAuthenticator.PASSWD_FILENAME_PROPERTY + " properties must be defined."); + } + } + + static String authenticationErrorMessage(PasswordMode mode, String username) + { + return String.format("Given password in password mode %s could not be validated for user %s", mode, username); + } +} Added: cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java?rev=1180076&view=auto ============================================================================== --- cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java (added) +++ cassandra/branches/cassandra-1.0.0/examples/simple_authentication/src/org/apache/cassandra/auth/SimpleAuthority.java Fri Oct 7 15:29:22 2011 @@ -0,0 +1,157 @@ +package org.apache.cassandra.auth; +/* + * + * 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. + * + */ + + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.EnumSet; +import java.util.List; +import java.util.Properties; + +import org.apache.cassandra.config.ConfigurationException; +import org.apache.cassandra.io.util.FileUtils; + +public class SimpleAuthority implements IAuthority +{ + public final static String ACCESS_FILENAME_PROPERTY = "access.properties"; + // magical property for WRITE permissions to the keyspaces list + public final static String KEYSPACES_WRITE_PROPERTY = "<modify-keyspaces>"; + + public EnumSet<Permission> authorize(AuthenticatedUser user, List<Object> resource) + { + if (resource.size() < 2 || !Resources.ROOT.equals(resource.get(0)) || !Resources.KEYSPACES.equals(resource.get(1))) + return Permission.NONE; + + String keyspace, columnFamily = null; + EnumSet<Permission> authorized = Permission.NONE; + + // /cassandra/keyspaces + if (resource.size() == 2) + { + keyspace = KEYSPACES_WRITE_PROPERTY; + authorized = EnumSet.of(Permission.READ); + } + // /cassandra/keyspaces/<keyspace name> + else if (resource.size() == 3) + { + keyspace = (String)resource.get(2); + } + // /cassandra/keyspaces/<keyspace name>/<cf name> + else if (resource.size() == 4) + { + keyspace = (String)resource.get(2); + columnFamily = (String)resource.get(3); + } + else + { + // We don't currently descend any lower in the hierarchy. + throw new UnsupportedOperationException(); + } + + String accessFilename = System.getProperty(ACCESS_FILENAME_PROPERTY); + InputStream in=null; + try + { + in = new BufferedInputStream(new FileInputStream(accessFilename)); + Properties accessProperties = new Properties(); + accessProperties.load(in); + + // Special case access to the keyspace list + if (keyspace == KEYSPACES_WRITE_PROPERTY) + { + String kspAdmins = accessProperties.getProperty(KEYSPACES_WRITE_PROPERTY); + for (String admin : kspAdmins.split(",")) + if (admin.equals(user.username)) + return Permission.ALL; + } + + boolean canRead = false, canWrite = false; + String readers = null, writers = null; + + if (columnFamily == null) + { + readers = accessProperties.getProperty(keyspace + ".<ro>"); + writers = accessProperties.getProperty(keyspace + ".<rw>"); + } + else + { + readers = accessProperties.getProperty(keyspace + "." + columnFamily + ".<ro>"); + writers = accessProperties.getProperty(keyspace + "." + columnFamily + ".<rw>"); + } + + if (readers != null) + { + for (String reader : readers.split(",")) + { + if (reader.equals(user.username)) + { + canRead = true; + break; + } + } + } + + if (writers != null) + { + for (String writer : writers.split(",")) + { + if (writer.equals(user.username)) + { + canWrite = true; + break; + } + } + } + + if (canWrite) + authorized = Permission.ALL; + else if (canRead) + authorized = EnumSet.of(Permission.READ); + + } + catch (IOException e) + { + throw new RuntimeException(String.format("Authorization table file '%s' could not be opened: %s", + accessFilename, + e.getMessage())); + } + finally + { + FileUtils.closeQuietly(in); + } + + return authorized; + } + + public void validateConfiguration() throws ConfigurationException + { + String afilename = System.getProperty(ACCESS_FILENAME_PROPERTY); + if (afilename == null) + { + throw new ConfigurationException(String.format("When using %s, '%s' property must be defined.", + this.getClass().getCanonicalName(), + ACCESS_FILENAME_PROPERTY)); + } + } +} Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/auth/IAuthenticator.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/auth/IAuthenticator.java?rev=1180076&r1=1180075&r2=1180076&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/auth/IAuthenticator.java (original) +++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/auth/IAuthenticator.java Fri Oct 7 15:29:22 2011 @@ -27,6 +27,9 @@ import org.apache.cassandra.thrift.Authe public interface IAuthenticator { + public static final String USERNAME_KEY = "username"; + public static final String PASSWORD_KEY = "password"; + /** * @return The user that a connection is initialized with, or 'null' if a user must call login(). */ Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java?rev=1180076&r1=1180075&r2=1180076&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java (original) +++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliClient.java Fri Oct 7 15:29:22 2011 @@ -32,7 +32,7 @@ import com.google.common.base.Charsets; import com.google.common.base.Joiner; import org.antlr.runtime.tree.Tree; -import org.apache.cassandra.auth.SimpleAuthenticator; +import org.apache.cassandra.auth.IAuthenticator; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.db.ColumnFamilyStoreMBean; import org.apache.cassandra.db.compaction.CompactionInfo; @@ -1833,8 +1833,8 @@ public class CliClient { /* remove quotes */ password = password.replace("\'", ""); - credentials.put(SimpleAuthenticator.USERNAME_KEY, username); - credentials.put(SimpleAuthenticator.PASSWORD_KEY, password); + credentials.put(IAuthenticator.USERNAME_KEY, username); + credentials.put(IAuthenticator.PASSWORD_KEY, password); authRequest = new AuthenticationRequest(credentials); thriftClient.login(authRequest); } Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliMain.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliMain.java?rev=1180076&r1=1180075&r2=1180076&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliMain.java (original) +++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cli/CliMain.java Fri Oct 7 15:29:22 2011 @@ -27,7 +27,7 @@ import java.util.*; import jline.ConsoleReader; import jline.History; -import org.apache.cassandra.auth.SimpleAuthenticator; +import org.apache.cassandra.auth.IAuthenticator; import org.apache.cassandra.thrift.*; import org.apache.thrift.TException; import org.apache.thrift.protocol.TBinaryProtocol; @@ -95,8 +95,8 @@ public class CliMain { // Authenticate Map<String, String> credentials = new HashMap<String, String>(); - credentials.put(SimpleAuthenticator.USERNAME_KEY, sessionState.username); - credentials.put(SimpleAuthenticator.PASSWORD_KEY, sessionState.password); + credentials.put(IAuthenticator.USERNAME_KEY, sessionState.username); + credentials.put(IAuthenticator.PASSWORD_KEY, sessionState.password); AuthenticationRequest authRequest = new AuthenticationRequest(credentials); try { Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyOutputFormat.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyOutputFormat.java?rev=1180076&r1=1180075&r2=1180076&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyOutputFormat.java (original) +++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyOutputFormat.java Fri Oct 7 15:29:22 2011 @@ -30,7 +30,7 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.apache.cassandra.auth.SimpleAuthenticator; +import org.apache.cassandra.auth.IAuthenticator; import org.apache.cassandra.thrift.*; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.*; @@ -154,8 +154,8 @@ public class ColumnFamilyOutputFormat ex if (ConfigHelper.getOutputKeyspaceUserName(conf) != null) { Map<String, String> creds = new HashMap<String, String>(); - creds.put(SimpleAuthenticator.USERNAME_KEY, ConfigHelper.getOutputKeyspaceUserName(conf)); - creds.put(SimpleAuthenticator.PASSWORD_KEY, ConfigHelper.getOutputKeyspacePassword(conf)); + creds.put(IAuthenticator.USERNAME_KEY, ConfigHelper.getOutputKeyspaceUserName(conf)); + creds.put(IAuthenticator.PASSWORD_KEY, ConfigHelper.getOutputKeyspacePassword(conf)); AuthenticationRequest authRequest = new AuthenticationRequest(creds); client.login(authRequest); } Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java?rev=1180076&r1=1180075&r2=1180076&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java (original) +++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java Fri Oct 7 15:29:22 2011 @@ -31,7 +31,7 @@ import java.util.*; import com.google.common.collect.AbstractIterator; -import org.apache.cassandra.auth.SimpleAuthenticator; +import org.apache.cassandra.auth.IAuthenticator; import org.apache.cassandra.config.ConfigurationException; import org.apache.cassandra.db.IColumn; import org.apache.cassandra.db.marshal.AbstractType; @@ -120,8 +120,8 @@ public class ColumnFamilyRecordReader ex if (ConfigHelper.getInputKeyspaceUserName(conf) != null) { Map<String, String> creds = new HashMap<String, String>(); - creds.put(SimpleAuthenticator.USERNAME_KEY, ConfigHelper.getInputKeyspaceUserName(conf)); - creds.put(SimpleAuthenticator.PASSWORD_KEY, ConfigHelper.getInputKeyspacePassword(conf)); + creds.put(IAuthenticator.USERNAME_KEY, ConfigHelper.getInputKeyspaceUserName(conf)); + creds.put(IAuthenticator.PASSWORD_KEY, ConfigHelper.getInputKeyspacePassword(conf)); AuthenticationRequest authRequest = new AuthenticationRequest(creds); client.login(authRequest); }