Skip to content

Commit

Permalink
RANGER-1935 - Upgrade Ranger to support Apache Hadoop 3.0.0
Browse files Browse the repository at this point in the history
RANGER-2148 - Update Ranger Hive dependency version to 3.0

RANGER-1935 - Upgrade Ranger to support Apache Hadoop 3.0.0 - add on changes to rebase the patch

Signed-off-by: rmani <rmani@hortonworks.com>

RANGER-1935: hadoop support changes

Signed-off-by: rmani <rmani@hortonworks.com>

RANGER-2151:Update Ranger Hbase dependency version to 2.0

RANGER-1935 : Upgrade Ranger to support Apache Hadoop 3.0.0 -Knox test case failure addressed
Signed-off-by: rmani <rmani@hortonworks.com>
  • Loading branch information
coheigea authored and rmani committed Feb 28, 2019
1 parent fc42892 commit f78cf3f
Show file tree
Hide file tree
Showing 55 changed files with 1,046 additions and 2,250 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -161,25 +160,6 @@ public static void init(String propFile) throws Exception {
LOG.debug("<== InMemoryJAASConfiguration.init( {} ) ", propFile);
}

@SuppressWarnings("unchecked")
public static void init(org.apache.commons.configuration.Configuration configuration) throws Exception {
LOG.debug("==> InMemoryJAASConfiguration.init()");

if (configuration != null && !configuration.isEmpty()) {
Properties properties = new Properties();
Iterator<String> iterator = configuration.getKeys();
while (iterator.hasNext()) {
String key = iterator.next();
properties.put(key, configuration.getProperty(key));
}
init(properties);
} else {
throw new Exception("Failed to load JAAS application properties: configuration NULL or empty!");
}

LOG.debug("<== InMemoryJAASConfiguration.init()");
}

public static void init(Properties properties) throws Exception {
LOG.debug("==> InMemoryJAASConfiguration.init()");

Expand Down
4 changes: 2 additions & 2 deletions credentialbuilder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<version>${commons.collections.version}</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>${commons.configuration.version}</version>
</dependency>
<dependency>
Expand Down
63 changes: 61 additions & 2 deletions hbase-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
<version>${hbase.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.ranger</groupId>
Expand All @@ -51,6 +57,12 @@
<groupId>org.apache.ranger</groupId>
<artifactId>ranger-plugins-audit</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
Expand All @@ -71,28 +83,75 @@
<version>${hbase.version}</version>
<type>test-jar</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-zookeeper</artifactId>
<type>test-jar</type>
<scope>test</scope>
<version>${hbase.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-hadoop2-compat</artifactId>
<version>${hbase.version}</version>
<type>test-jar</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-hadoop-compat</artifactId>
<version>${hbase.version}</version>
<type>test-jar</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minicluster</artifactId>
<version>${hadoop.hbase.version}</version>
<version>${hadoop.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-auth</artifactId>
<version>${hadoop.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>${hadoop.version}</version>
<scope>test</scope>
</dependency>

</dependencies>
<build>
<testResources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.ranger.plugin.policyengine.RangerAccessResult;
import org.apache.ranger.plugin.service.RangerBasePlugin;

import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

Expand Down Expand Up @@ -334,7 +334,7 @@ String getDenialReason() {
}

String requestToString() {
return Objects.toStringHelper(_request.getClass())
return MoreObjects.toStringHelper(_request.getClass())
.add("operation", _operation)
.add("otherInformation", _otherInformation)
.add("access", _access)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.security.access.Permission.Action;
import org.apache.hadoop.hbase.util.Bytes;
Expand Down Expand Up @@ -56,7 +56,7 @@ public boolean isWriteAccess(String access) {

@Override
public String getTable(RegionCoprocessorEnvironment regionServerEnv) {
HRegionInfo hri = regionServerEnv.getRegion().getRegionInfo();
RegionInfo hri = regionServerEnv.getRegion().getRegionInfo();
byte[] tableName = hri.getTable().getName();
String tableNameStr = Bytes.toString(tableName);
if (LOG.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
Expand Down Expand Up @@ -88,7 +89,12 @@ public Set<String> getUserGroups(User user) {
@Override
public User getUser() {
// current implementation does not use the request object!
User user = RpcServer.getRequestUser();
User user = null;
try {
user = RpcServer.getRequestUser().get();
} catch (NoSuchElementException e) {
LOG.info("Unable to get request user");
}
if (user == null) {
try {
user = User.getCurrent();
Expand Down
Loading

0 comments on commit f78cf3f

Please sign in to comment.