spmallette commented on a change in pull request #1308:
URL: https://github.com/apache/tinkerpop/pull/1308#discussion_r513516584



##########
File path: 
gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java
##########
@@ -200,6 +211,35 @@ private Authenticator createAuthenticator(final 
Settings.AuthenticationSettings
         }
     }
 
+    private Authorizer createAuthorizer(final Settings.AuthorizationSettings 
config) {
+        final String authorizerClass = config.authorizer;
+        if (null == authorizerClass) {
+            return null;
+        }
+        try {
+            final Class<?> clazz = Class.forName(authorizerClass);
+            final Authorizer authorizer = (Authorizer) clazz.newInstance();
+            authorizer.configure(config.config);
+            return authorizer;
+        } catch (Exception ex) {
+            logger.warn(ex.getMessage());
+            throw new IllegalStateException(String.format("Could not 
create/configure Authorizer %s", authorizer), ex);
+        }
+    }
+
+    private AuthenticatorAuthorizer createAuthenticatorAuthorizer(final 
Settings settings) {
+        try {
+            final Class<?> clazz = 
Class.forName(settings.authentication.authenticator);
+            final AuthenticatorAuthorizer authenticatorAuthorizer = 
(AuthenticatorAuthorizer) clazz.newInstance();
+            authenticatorAuthorizer.setup(settings.authentication.config);
+            authenticatorAuthorizer.configure(settings.authorization.config);

Review comment:
       I'm +0 with the `AuthenticatorAuthorizer` - whatever you decide on that 
is fine by me. I'm more concerned in just naming those methods the same thing.  
I probably shouldn't have written that the methods should have the same 
signature I guess...just the same name. I guess we would go with `setup()` 
which is somewhat at odds with all our other things which use `configure()` but 
meh...it's fine




----------------------------------------------------------------
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.

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


Reply via email to