|
35 | 35 |
|
36 | 36 | import java.io.File; |
37 | 37 | import java.io.IOException; |
| 38 | +import java.security.PrivilegedExceptionAction; |
38 | 39 | import java.time.Instant; |
39 | 40 | import java.util.HashMap; |
40 | 41 | import java.util.UUID; |
|
62 | 63 | import org.apache.hadoop.ozone.TestDataUtil; |
63 | 64 | import org.apache.hadoop.ozone.client.BucketArgs; |
64 | 65 | import org.apache.hadoop.ozone.client.OzoneBucket; |
| 66 | +import org.apache.hadoop.ozone.client.OzoneClient; |
| 67 | +import org.apache.hadoop.ozone.client.OzoneClientFactory; |
65 | 68 | import org.apache.hadoop.ozone.client.OzoneKey; |
66 | 69 | import org.apache.hadoop.ozone.client.OzoneVolume; |
67 | 70 | import org.apache.hadoop.ozone.client.SecretKeyTestClient; |
|
84 | 87 | import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.S3Authentication; |
85 | 88 | import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status; |
86 | 89 | import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.VolumeInfo; |
| 90 | +import org.apache.hadoop.security.AccessControlException; |
87 | 91 | import org.apache.hadoop.security.UserGroupInformation; |
88 | 92 | import org.apache.ozone.test.GenericTestUtils; |
89 | 93 | import org.junit.jupiter.api.AfterAll; |
@@ -425,6 +429,21 @@ public void testS3Auth() throws Exception { |
425 | 429 | assertEquals(Status.INVALID_TOKEN, omResponse.getStatus()); |
426 | 430 | } |
427 | 431 |
|
| 432 | + @Test |
| 433 | + public void testRemoteException() { |
| 434 | + UserGroupInformation realUser = UserGroupInformation.createRemoteUser("realUser"); |
| 435 | + UserGroupInformation proxyUser = UserGroupInformation.createProxyUser("user", realUser); |
| 436 | + |
| 437 | + assertThrows(AccessControlException.class, () -> { |
| 438 | + proxyUser.doAs((PrivilegedExceptionAction<Void>) () -> { |
| 439 | + try (OzoneClient ozoneClient = OzoneClientFactory.getRpcClient(getCluster().getConf())) { |
| 440 | + ozoneClient.getObjectStore().listVolumes("/"); |
| 441 | + } |
| 442 | + return null; |
| 443 | + }); |
| 444 | + }); |
| 445 | + } |
| 446 | + |
428 | 447 | @Test |
429 | 448 | @Override |
430 | 449 | // Restart DN doesn't work with security enabled. |
|
0 commit comments