[ https://issues.apache.org/jira/browse/DRILL-5568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16054921#comment-16054921 ]
ASF GitHub Bot commented on DRILL-5568: --------------------------------------- Github user sohami commented on a diff in the pull request: https://github.com/apache/drill/pull/849#discussion_r122847012 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/security/SecurityConfiguration.java --- @@ -0,0 +1,44 @@ +/* + * 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.drill.exec.rpc.security; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.CommonConfigurationKeys; + + +public class SecurityConfiguration extends Configuration { + //private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SecurityConfiguration.class); + + public SecurityConfiguration() { + super(); + updateGroupMapping(); + } + + /** + * Update the Group Mapping class name to add namespace prefix retrieved from System Property. This is needed since + * in drill-jdbc-all jar we are packaging hadoop dependencies under that namespace. This will help application + * using this jar as driver to avoid conflict with it's own hadoop dependency if any. + */ + private void updateGroupMapping() { + final String originalClassName = get(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING); + final String profilePrefix = System.getProperty("namespacePrefix"); + final String updatedClassName = (profilePrefix != null) ? (profilePrefix + originalClassName) + : originalClassName; + set(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING, updatedClassName); --- End diff -- Changed to use` Strings.isNullOrEmpty`. I am already trimming the value of prefix befire setting it inside system property. > Include hadoop-common jars inside drill-jdbc-all.jar > ---------------------------------------------------- > > Key: DRILL-5568 > URL: https://issues.apache.org/jira/browse/DRILL-5568 > Project: Apache Drill > Issue Type: Bug > Components: Client - JDBC > Reporter: Sorabh Hamirwasia > Assignee: Sorabh Hamirwasia > > With Sasl support in 1.10 the authentication using username/password was > moved to Plain Mechanism of Sasl Framework. There are couple of Hadoop > classes like Configuration.java and UserGroupInformation.java defined in > hadoop-common package which were used in DrillClient for security mechanisms > like Plain/Kerberos mechanisms. Due to this we need to add hadoop dependency > inside _drill-jdbc-all.jar_ Without it the application using this driver > will fail to connect to Drill with authentication enabled. > Today this jar (which is JDBC driver for Drill) already has lots of other > dependencies which DrillClient relies on like Netty, etc. But the way we add > these dependencies are under *oadd* namespace so that the application using > this driver won't end up in conflict with it's own version of same > dependencies. As part of this JIRA it will include hadoop-common dependencies > under same namespace. This will allow an application to connect to Drill > using this driver with security enabled. -- This message was sent by Atlassian JIRA (v6.4.14#64029)