/** * In remote mode, we should not cache the explore request */ @Override protected boolean checkExploreAndDetermineCache(ImpersonationRequest impersonationRequest) throws IOException { return !(impersonationRequest.getEntityId().getEntityType().equals(EntityType.NAMESPACE) && impersonationRequest.getImpersonatedOpType().equals(ImpersonatedOpType.EXPLORE)); }
Assert.assertArrayEquals(aliceImpRequest.getImpersonatedOpType().toString().getBytes(StandardCharsets.UTF_8), token.getIdentifier()); Assert.assertArrayEquals(aliceImpRequest.getImpersonatedOpType().toString().getBytes(StandardCharsets.UTF_8), token.getPassword()); Assert.assertEquals(new Text("opType"), token.getKind());
@Override public final UGIWithPrincipal getConfiguredUGI(ImpersonationRequest impersonationRequest) throws IOException { try { UGIWithPrincipal ugi = impersonationRequest.getImpersonatedOpType().equals(ImpersonatedOpType.EXPLORE) || impersonationRequest.getPrincipal() == null ? null : ugiCache.getIfPresent(new UGICacheKey(impersonationRequest)); if (ugi != null) { return ugi; } boolean isCache = checkExploreAndDetermineCache(impersonationRequest); ImpersonationInfo info = getPrincipalForEntity(impersonationRequest); ImpersonationRequest newRequest = new ImpersonationRequest(impersonationRequest.getEntityId(), impersonationRequest.getImpersonatedOpType(), info.getPrincipal(), info.getKeytabURI()); return isCache ? ugiCache.get(new UGICacheKey(newRequest)) : createUGI(newRequest); } catch (ExecutionException e) { Throwable cause = e.getCause(); // Propagate if the cause is an IOException or RuntimeException Throwables.propagateIfPossible(cause, IOException.class); // Otherwise always wrap it with IOException throw new IOException(cause); } }
protected boolean checkExploreAndDetermineCache(ImpersonationRequest impersonationRequest) throws IOException { if (impersonationRequest.getEntityId().getEntityType().equals(EntityType.NAMESPACE) && impersonationRequest.getImpersonatedOpType().equals(ImpersonatedOpType.EXPLORE)) {