diff --git a/src/java/org/apache/cassandra/auth/AuthConfig.java b/src/java/org/apache/cassandra/auth/AuthConfig.java index 67d4490790ee..86e1f626ff81 100644 --- a/src/java/org/apache/cassandra/auth/AuthConfig.java +++ b/src/java/org/apache/cassandra/auth/AuthConfig.java @@ -20,6 +20,8 @@ import java.util.List; +import com.google.common.annotations.VisibleForTesting; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,6 +40,16 @@ public final class AuthConfig private static boolean initialized; + /** + * Resets the initialized flag, enabling AuthConfig to be reconfigured multiple times within a single + * test case. + */ + @VisibleForTesting + static void reset() + { + initialized = false; + } + public static void applyAuth() { // some tests need this diff --git a/src/java/org/apache/cassandra/auth/CassandraRoleManager.java b/src/java/org/apache/cassandra/auth/CassandraRoleManager.java index d7cdbfee9403..d46526a71d22 100644 --- a/src/java/org/apache/cassandra/auth/CassandraRoleManager.java +++ b/src/java/org/apache/cassandra/auth/CassandraRoleManager.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -86,29 +85,16 @@ import static org.apache.cassandra.utils.ByteBufferUtil.bytes; /** - * Responsible for the creation, maintenance and deletion of roles - * for the purposes of authentication and authorization. - * Role data is stored internally, using the roles and role_members tables - * in the system_auth keyspace. + * Responsible for the creation, maintenance and deletion of roles for the purposes of authentication and + * authorization. Role data is stored internally, using the roles and role_members tables in the system_auth + * keyspace. * - * Additionally, if org.apache.cassandra.auth.PasswordAuthenticator is used, - * encrypted passwords are also stored in the system_auth.roles table. This - * coupling between the IAuthenticator and IRoleManager implementations exists - * because setting a role's password via CQL is done with a CREATE ROLE or - * ALTER ROLE statement, the processing of which is handled by IRoleManager. - * As IAuthenticator is concerned only with credentials checking and has no - * means to modify passwords, PasswordAuthenticator depends on - * CassandraRoleManager for those functions. - * - * Alternative IAuthenticator implementations may be used in conjunction with - * CassandraRoleManager, but WITH PASSWORD = 'password' will not be supported - * in CREATE/ALTER ROLE statements. - * - * Such a configuration could be implemented using a custom IRoleManager that - * extends CassandraRoleManager and which includes Option.PASSWORD in the {@code Set