maheshk114 commented on a change in pull request #793: HIVE-22267 : Support 
password based authentication for HMS along-side kerberos authentication.
URL: https://github.com/apache/hive/pull/793#discussion_r331355497
 
 

 ##########
 File path: 
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreConfigAuthenticationProviderImpl.java
 ##########
 @@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.metastore;
+
+import javax.security.sasl.AuthenticationException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This authentication provider implements the {@code CONFIG} authentication. 
It allows a {@link
+ * MetaStorePasswdAuthenticationProvider} to be specified at configuration 
time which may
+ * additionally
+ * implement {@link org.apache.hadoop.conf.Configurable Configurable} to grab 
HMS's {@link
+ * org.apache.hadoop.conf.Configuration Configuration}.
+ */
+public class MetaStoreConfigAuthenticationProviderImpl implements 
MetaStorePasswdAuthenticationProvider {
+  private final String userName;
+  private final String password;
+  protected static final Logger LOG = 
LoggerFactory.getLogger(MetaStoreConfigAuthenticationProviderImpl.class);
+
+  @SuppressWarnings("unchecked")
+  MetaStoreConfigAuthenticationProviderImpl(Configuration conf) throws 
AuthenticationException {
+    userName = MetastoreConf.getVar(conf, 
MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_USERNAME);
+    password = MetastoreConf.getVar(conf, 
MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_PASSWORD);
+
+    if (null == userName || userName.isEmpty()) {
+      throw new AuthenticationException("No username specified in " + 
MetastoreConf.ConfVars.THRIFT_AUTH_CONFIG_USERNAME);
+    }
+
+    if (null == password || password.isEmpty()) {
 
 Review comment:
   password can be empty 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to