Skip to content

Commit

Permalink
Throw UnauthenticatedException as is from RPCs
Browse files Browse the repository at this point in the history
pr-link: #9098
change-id: cid-f60c32eb07c7f5782b2df7f73f4e3a687df35e07
  • Loading branch information
ggezer authored and alluxio-bot committed May 17, 2019
1 parent df7ccc8 commit 0b4989e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Expand Up @@ -34,6 +34,7 @@
import alluxio.exception.status.FailedPreconditionException;
import alluxio.exception.status.InvalidArgumentException;
import alluxio.exception.status.NotFoundException;
import alluxio.exception.status.UnauthenticatedException;
import alluxio.exception.status.UnavailableException;
import alluxio.grpc.CreateDirectoryPOptions;
import alluxio.grpc.CreateFilePOptions;
Expand Down Expand Up @@ -589,6 +590,8 @@ private <R> R rpc(RpcCallable<FileSystemMasterClient, R> fn)
throw new DirectoryNotEmptyException(e.getMessage());
} catch (UnavailableException e) {
throw e;
} catch (UnauthenticatedException e) {
throw e;
} catch (AlluxioStatusException e) {
throw e.toAlluxioException();
}
Expand Down
Expand Up @@ -123,6 +123,7 @@ public final class FileSystemContext implements Closeable {
*/
private final ConcurrentHashMap<ClientPoolKey, BlockWorkerClientPool>
mBlockWorkerClientPool = new ConcurrentHashMap<>();

/**
* Used in {@link #mBlockWorkerClientPool}.
*/
Expand Down
Expand Up @@ -18,7 +18,7 @@
import alluxio.client.file.URIStatus;
import alluxio.conf.PropertyKey;
import alluxio.conf.ServerConfiguration;
import alluxio.exception.AccessControlException;
import alluxio.exception.status.UnauthenticatedException;
import alluxio.grpc.SetAttributePOptions;
import alluxio.security.CurrentUser;
import alluxio.security.authorization.Mode;
Expand Down Expand Up @@ -136,7 +136,7 @@ public void impersonationHdfsDisabled() throws Exception {
try {
checkCreateFile(createHdfsSubject(), HDFS_USER);
Assert.fail("Connection succeeded, but impersonation should be denied.");
} catch (AccessControlException e) {
} catch (UnauthenticatedException e) {
// expected
}
}
Expand All @@ -161,7 +161,7 @@ public void impersonationHdfsUserDenied() throws Exception {
try {
checkCreateFile(createHdfsSubject(), HDFS_USER);
Assert.fail("Connection succeeded, but impersonation should be denied.");
} catch (AccessControlException e) {
} catch (UnauthenticatedException e) {
// expected
}
}
Expand Down Expand Up @@ -202,7 +202,7 @@ public void impersonationUsersDeniedGroupsDenied() throws Exception {
try {
checkCreateFile(createHdfsSubject(), HDFS_USER);
Assert.fail("Connection succeeded, but impersonation should be denied.");
} catch (AccessControlException e) {
} catch (UnauthenticatedException e) {
// expected
}
}
Expand All @@ -227,7 +227,7 @@ public void impersonationHdfsGroupDenied() throws Exception {
try {
checkCreateFile(createHdfsSubject(), HDFS_USER);
Assert.fail("Connection succeeded, but impersonation should be denied.");
} catch (AccessControlException e) {
} catch (UnauthenticatedException e) {
// expected
}
}
Expand Down

0 comments on commit 0b4989e

Please sign in to comment.