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



##########
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:
       `setup()` for authentication and `configure()` for authorization - could 
we simply unify these and go with `setup()` for both? As long as the two 
methods have the same name/signature then it should look like one method from 
an inheritance perspective, no?




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