File tree 3 files changed +20
-3
lines changed
src/main/java/tech/stackable/hadoop
3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
<groupId >tech.stackable</groupId >
6
6
<artifactId >hdfs-utils</artifactId >
7
- <version >0.1.0 </version >
7
+ <version >0.1.1 </version >
8
8
9
9
<name >Apache Hadoop HDFS utils</name >
10
10
<url >https://github.com/stackabletech/hdfs-utils/</url >
Original file line number Diff line number Diff line change 1
1
package tech .stackable .hadoop ;
2
2
3
3
import org .apache .hadoop .hdfs .server .namenode .INodeAttributeProvider ;
4
+ import org .apache .hadoop .security .UserGroupInformation ;
4
5
5
6
public class OpaAllowQuery {
6
7
public final OpaAllowQueryInput input ;
@@ -9,9 +10,14 @@ public OpaAllowQuery(OpaAllowQueryInput input) {
9
10
this .input = input ;
10
11
}
11
12
13
+ /**
14
+ * Wrapper around {@link INodeAttributeProvider.AuthorizationContext}, which uses our custom wrapper around
15
+ * {@link UserGroupInformation}, {@link OpaQueryUgi}.
16
+ */
12
17
public static class OpaAllowQueryInput {
13
18
public java .lang .String fsOwner ;
14
19
public java .lang .String supergroup ;
20
+ // Wrapping this
15
21
public OpaQueryUgi callerUgi ;
16
22
public org .apache .hadoop .hdfs .server .namenode .INodeAttributes [] inodeAttrs ;
17
23
public org .apache .hadoop .hdfs .server .namenode .INode [] inodes ;
Original file line number Diff line number Diff line change 6
6
import java .util .List ;
7
7
8
8
public class OpaQueryUgi {
9
- public UserGroupInformation realUser ;
9
+ // Wrapping this
10
+ public OpaQueryUgi realUser ;
10
11
public String userName ;
11
12
public String shortUserName ;
12
13
@@ -16,8 +17,18 @@ public class OpaQueryUgi {
16
17
public UserGroupInformation .AuthenticationMethod authenticationMethod ;
17
18
public UserGroupInformation .AuthenticationMethod realAuthenticationMethod ;
18
19
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/hive-iceberg.default.svc.cluster.local@KNAB.COM (auth:KERBEROS)"
24
+ */
19
25
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
+ }
21
32
this .userName = ugi .getUserName ();
22
33
this .shortUserName = ugi .getShortUserName ();
23
34
try {
You can’t perform that action at this time.
0 commit comments