yifan-c commented on code in PR #165:
URL: https://github.com/apache/cassandra-sidecar/pull/165#discussion_r1908036112


##########
server/src/main/java/org/apache/cassandra/sidecar/server/MainModule.java:
##########
@@ -245,11 +256,52 @@ public ChainAuthHandler chainAuthHandler(Vertx vertx,
         return chainAuthHandler;
     }
 
+    @Provides
+    @Singleton
+    public AuthorizationProvider authorizationProvider(SidecarConfiguration 
sidecarConfiguration,
+                                                       IdentityToRoleCache 
identityToRoleCache,
+                                                       RoleAuthorizationsCache 
roleAuthorizationsCache)
+    {
+        AccessControlConfiguration accessControlConfiguration = 
sidecarConfiguration.accessControlConfiguration();
+        if (!accessControlConfiguration.enabled())
+        {
+            return AllowAllAuthorizationProvider.INSTANCE;
+        }
+
+        ParameterizedClassConfiguration config = 
accessControlConfiguration.authorizerConfiguration();
+        if (config == null)
+        {
+            throw new ConfigurationException("Access control is enabled, but 
authorizer not set");
+        }

Review Comment:
   OK. As long as we make it clear upfront. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to