cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [3/6] cassandra git commit: Defer initialization of default RoleManager until IAuthenticator is set reviewed by jbellis for CASSANDRA-10209
Date Mon, 31 Aug 2015 17:05:01 GMT
Defer initialization of default RoleManager until IAuthenticator is set
reviewed by jbellis for CASSANDRA-10209


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0d2f4038
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0d2f4038
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0d2f4038

Branch: refs/heads/trunk
Commit: 0d2f4038fc2564c695d0d8c4b1ad523ec1afaceb
Parents: c870adc
Author: Sam Tunnicliffe <sam@beobal.com>
Authored: Thu Aug 27 20:21:17 2015 +0100
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Mon Aug 31 12:04:01 2015 -0500

----------------------------------------------------------------------
 .../org/apache/cassandra/config/DatabaseDescriptor.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0d2f4038/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index b7e3eaa..9cf3959 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -87,7 +87,9 @@ public class DatabaseDescriptor
 
     private static IAuthenticator authenticator = new AllowAllAuthenticator();
     private static IAuthorizer authorizer = new AllowAllAuthorizer();
-    private static IRoleManager roleManager = new CassandraRoleManager();
+    // Don't initialize the role manager until applying config. The options supported by
CassandraRoleManager
+    // depend on the configured IAuthenticator, so defer creating it until that's been set.
+    private static IRoleManager roleManager;
 
     private static IRequestScheduler requestScheduler;
     private static RequestSchedulerId requestSchedulerId;
@@ -323,8 +325,9 @@ public class DatabaseDescriptor
         if (authenticator instanceof AllowAllAuthenticator && !(authorizer instanceof
AllowAllAuthorizer))
             throw new ConfigurationException("AllowAllAuthenticator can't be used with "
+  conf.authorizer, false);
 
-        if (conf.role_manager != null)
-            roleManager = FBUtilities.newRoleManager(conf.role_manager);
+        roleManager = conf.role_manager == null
+                    ? new CassandraRoleManager()
+                    : FBUtilities.newRoleManager(conf.role_manager);
 
         if (authenticator instanceof PasswordAuthenticator && !(roleManager instanceof
CassandraRoleManager))
             throw new ConfigurationException("CassandraRoleManager must be used with PasswordAuthenticator",
false);


Mime
View raw message