File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
src/main/java/tech/stackable/hadoop Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 44
55 <groupId >tech.stackable</groupId >
66 <artifactId >hdfs-utils</artifactId >
7- <version >0.1.0 </version >
7+ <version >0.1.1 </version >
88
99 <name >Apache Hadoop HDFS utils</name >
1010 <url >https://github.com/stackabletech/hdfs-utils/</url >
Original file line number Diff line number Diff line change 11package tech .stackable .hadoop ;
22
33import org .apache .hadoop .hdfs .server .namenode .INodeAttributeProvider ;
4+ import org .apache .hadoop .security .UserGroupInformation ;
45
56public class OpaAllowQuery {
67 public final OpaAllowQueryInput input ;
@@ -9,9 +10,14 @@ public OpaAllowQuery(OpaAllowQueryInput input) {
910 this .input = input ;
1011 }
1112
13+ /**
14+ * Wrapper around {@link INodeAttributeProvider.AuthorizationContext}, which uses our custom wrapper around
15+ * {@link UserGroupInformation}, {@link OpaQueryUgi}.
16+ */
1217 public static class OpaAllowQueryInput {
1318 public java .lang .String fsOwner ;
1419 public java .lang .String supergroup ;
20+ // Wrapping this
1521 public OpaQueryUgi callerUgi ;
1622 public org .apache .hadoop .hdfs .server .namenode .INodeAttributes [] inodeAttrs ;
1723 public org .apache .hadoop .hdfs .server .namenode .INode [] inodes ;
Original file line number Diff line number Diff line change 66import java .util .List ;
77
88public class OpaQueryUgi {
9- public UserGroupInformation realUser ;
9+ // Wrapping this
10+ public OpaQueryUgi realUser ;
1011 public String userName ;
1112 public String shortUserName ;
1213
@@ -16,8 +17,18 @@ public class OpaQueryUgi {
1617 public UserGroupInformation .AuthenticationMethod authenticationMethod ;
1718 public UserGroupInformation .AuthenticationMethod realAuthenticationMethod ;
1819
20+ /**
21+ * Wrapper around {@link UserGroupInformation}, which does not throw random errors during serialization when no primary
22+ * group is known for the user.
23+ * "Caused by: com.fasterxml.jackson.databind.JsonMappingException: Unexpected IOException (of type java.io.IOException): There is no primary group for UGI hive/[email protected] (auth:KERBEROS)" 24+ */
1925 public OpaQueryUgi (UserGroupInformation ugi ) {
20- this .realUser = ugi .getRealUser ();
26+ UserGroupInformation realUser = ugi .getRealUser ();
27+ if (realUser != null ) {
28+ this .realUser = new OpaQueryUgi (ugi .getRealUser ());
29+ } else {
30+ this .realUser = null ;
31+ }
2132 this .userName = ugi .getUserName ();
2233 this .shortUserName = ugi .getShortUserName ();
2334 try {
You can’t perform that action at this time.
0 commit comments