Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>tech.stackable</groupId>
<artifactId>hdfs-utils</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>

<name>Apache Hadoop HDFS utils</name>
<url>https://github.com/stackabletech/hdfs-utils/</url>
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/tech/stackable/hadoop/OpaAllowQuery.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tech.stackable.hadoop;

import org.apache.hadoop.hdfs.server.namenode.INodeAttributeProvider;
import org.apache.hadoop.security.UserGroupInformation;

public class OpaAllowQuery {
public final OpaAllowQueryInput input;
Expand All @@ -9,9 +10,14 @@ public OpaAllowQuery(OpaAllowQueryInput input) {
this.input = input;
}

/**
* Wrapper around {@link INodeAttributeProvider.AuthorizationContext}, which uses our custom wrapper around
* {@link UserGroupInformation}, {@link OpaQueryUgi}.
*/
public static class OpaAllowQueryInput {
public java.lang.String fsOwner;
public java.lang.String supergroup;
// Wrapping this
public OpaQueryUgi callerUgi;
public org.apache.hadoop.hdfs.server.namenode.INodeAttributes[] inodeAttrs;
public org.apache.hadoop.hdfs.server.namenode.INode[] inodes;
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/tech/stackable/hadoop/OpaQueryUgi.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import java.util.List;

public class OpaQueryUgi {
public UserGroupInformation realUser;
// Wrapping this
public OpaQueryUgi realUser;
public String userName;
public String shortUserName;

Expand All @@ -16,8 +17,18 @@ public class OpaQueryUgi {
public UserGroupInformation.AuthenticationMethod authenticationMethod;
public UserGroupInformation.AuthenticationMethod realAuthenticationMethod;

/**
* Wrapper around {@link UserGroupInformation}, which does not throw random errors during serialization when no primary
* group is known for the user.
* "Caused by: com.fasterxml.jackson.databind.JsonMappingException: Unexpected IOException (of type java.io.IOException): There is no primary group for UGI hive/hive-iceberg.default.svc.cluster.local@KNAB.COM (auth:KERBEROS)"
*/
public OpaQueryUgi(UserGroupInformation ugi) {
this.realUser = ugi.getRealUser();
UserGroupInformation realUser = ugi.getRealUser();
if (realUser != null) {
this.realUser = new OpaQueryUgi(ugi.getRealUser());
} else {
this.realUser = null;
}
this.userName = ugi.getUserName();
this.shortUserName = ugi.getShortUserName();
try {
Expand Down