smiklosovic commented on code in PR #3564:
URL: https://github.com/apache/cassandra/pull/3564#discussion_r1773341187
##########
src/java/org/apache/cassandra/auth/AuthConfig.java:
##########
@@ -133,4 +124,21 @@ public static void applyAuth()
cidrAuthorizer.validateConfiguration();
DatabaseDescriptor.getInternodeAuthenticator().validateConfiguration();
}
+
+ public static <T> T authInstantiate(ParameterizedClass authCls, Class<T>
defaultCls) {
+ if (authCls != null && authCls.class_name != null)
+ {
+ String authPackage = AuthConfig.class.getPackage().getName();
+ return ParameterizedClass.newInstance(authCls, Arrays.asList("",
authPackage));
Review Comment:
@tiagomlalves btw I think that it would be nicer if newInstance just took
`authPackage` and empty string would be covered automatically. `Array.asList`
might be also changed to `List.of()`. Or even better, `newInstance(authCls,
authPackage)` might be like this `newInstance(String clazz, String...
packages)`.
This stuff is often used in integrations so I would keep the original
version as well and it would translate to this new form internally.
##########
src/java/org/apache/cassandra/auth/AuthConfig.java:
##########
@@ -133,4 +124,21 @@ public static void applyAuth()
cidrAuthorizer.validateConfiguration();
DatabaseDescriptor.getInternodeAuthenticator().validateConfiguration();
}
+
+ public static <T> T authInstantiate(ParameterizedClass authCls, Class<T>
defaultCls) {
+ if (authCls != null && authCls.class_name != null)
+ {
+ String authPackage = AuthConfig.class.getPackage().getName();
+ return ParameterizedClass.newInstance(authCls, Arrays.asList("",
authPackage));
Review Comment:
@tiagomlalves btw I think that it would be nicer if `newInstance` just took
`authPackage` and empty string would be covered automatically. `Array.asList`
might be also changed to `List.of()`. Or even better, `newInstance(authCls,
authPackage)` might be like this `newInstance(String clazz, String...
packages)`.
This stuff is often used in integrations so I would keep the original
version as well and it would translate to this new form internally.
--
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]