deniskuzZ commented on code in PR #5870:
URL: https://github.com/apache/hive/pull/5870#discussion_r2146974394


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ServletSecurity.java:
##########
@@ -78,33 +78,37 @@
  * </p>
  */
 public class ServletSecurity {
+  public enum AuthType {
+    NONE, SIMPLE, JWT;
+
+    public static AuthType fromString(String type) {
+      return AuthType.valueOf(type.toUpperCase());
+    }
+  }
+
   private static final Logger LOG = 
LoggerFactory.getLogger(ServletSecurity.class);
   static final String X_USER = MetaStoreUtils.USER_NAME_HTTP_HEADER;
   private final boolean isSecurityEnabled;
-  private final boolean jwtAuthEnabled;
+  private final AuthType authType;
   private final Configuration conf;
   private JWTValidator jwtValidator = null;
 
-  public ServletSecurity(String authType, Configuration conf) {
-    this(conf, isAuthJwt(authType));
-  }
-
-  public ServletSecurity(Configuration conf, boolean jwt) {
+  public ServletSecurity(AuthType authType, Configuration conf) {
     this.conf = conf;
     this.isSecurityEnabled = UserGroupInformation.isSecurityEnabled();
-    this.jwtAuthEnabled = jwt;
+    this.authType = authType;
   }
 
-  private static boolean isAuthJwt(String authType) {
-    return "jwt".equalsIgnoreCase(authType);
+  public ServletSecurity(Configuration conf, boolean jwt) {
+    this(jwt ? AuthType.JWT : AuthType.SIMPLE, conf);

Review Comment:
   this looks confusing, can we get rid of this constructor?



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to