Skip to content

Commit

Permalink
[apache#4759] feat(auth-ranger): Use Spark verify Ranger authorizatio…
Browse files Browse the repository at this point in the history
…n Hive
  • Loading branch information
xunliu committed Sep 26, 2024
1 parent 1f98956 commit c6e9453
Show file tree
Hide file tree
Showing 10 changed files with 388 additions and 221 deletions.
42 changes: 26 additions & 16 deletions authorizations/authorization-ranger/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ plugins {
id("idea")
}

val scalaVersion: String = project.properties["scalaVersion"] as? String ?: extra["defaultScalaVersion"].toString()
val sparkVersion: String = libs.versions.spark35.get()
val kyuubiVersion: String = libs.versions.kyuubi4spark35.get()

dependencies {
implementation(project(":api")) {
exclude(group = "*")
Expand Down Expand Up @@ -69,24 +73,30 @@ dependencies {
testImplementation(libs.mockito.core)
testImplementation(libs.testcontainers)
testRuntimeOnly(libs.junit.jupiter.engine)
testImplementation(libs.ranger.intg) {
exclude("org.apache.hive", "hive-storage-api")
exclude("org.apache.lucene")
exclude("org.apache.solr")
exclude("org.apache.kafka")
exclude("org.eclipse.jetty")
exclude("org.elasticsearch")
exclude("org.elasticsearch.client")
exclude("org.elasticsearch.plugin")
exclude("javax.ws.rs")
exclude("org.apache.ranger", "ranger-plugin-classloader")
}
testImplementation(libs.hive2.jdbc) {
exclude("org.slf4j")
exclude("org.eclipse.jetty.aggregate")
}
testImplementation(libs.mysql.driver)
testImplementation(libs.postgresql.driver)
testImplementation(libs.postgresql.driver)
testImplementation("org.apache.spark:spark-hive_$scalaVersion:$sparkVersion")
testImplementation("org.apache.spark:spark-sql_$scalaVersion:$sparkVersion") {
exclude("org.apache.avro")
exclude("org.apache.hadoop")
exclude("org.apache.zookeeper")
exclude("io.dropwizard.metrics")
exclude("org.rocksdb")
}
testImplementation("org.apache.kyuubi:kyuubi-spark-authz_$scalaVersion:$kyuubiVersion") {
exclude("com.sun.jersey")
}
testImplementation(libs.hadoop3.client)
testImplementation(libs.hadoop3.common) {
exclude("com.sun.jersey")
exclude("javax.servlet", "servlet-api")
}
testImplementation(libs.hadoop3.hdfs) {
exclude("com.sun.jersey")
exclude("javax.servlet", "servlet-api")
exclude("io.netty")
}
}

tasks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.gravitino.authorization.SecurableObject;
import org.apache.gravitino.authorization.SecurableObjects;
import org.apache.gravitino.exceptions.AuthorizationPluginException;
import org.apache.ranger.RangerClient;
import org.apache.ranger.RangerServiceException;
import org.apache.ranger.plugin.model.RangerPolicy;
import org.apache.ranger.plugin.model.RangerRole;
Expand All @@ -60,12 +61,12 @@ public class RangerHelper {
/** The policy search keys */
private final List<String> policyResourceDefines;

private final RangerClientExtension rangerClient;
private final RangerClient rangerClient;
private final String rangerAdminName;
private final String rangerServiceName;

public RangerHelper(
RangerClientExtension rangerClient,
RangerClient rangerClient,
String rangerAdminName,
String rangerServiceName,
Map<Privilege.Name, Set<RangerPrivilege>> privilegesMapping,
Expand Down
Loading

0 comments on commit c6e9453

Please sign in to comment.