@Test public void proxyUsersAndGroupsAllMissing() { String userName = System.getProperty("user.name"); prepareHdfsConfFiles(ImmutableMap.of("hadoop.proxyuser.bob.users", "user1,user3", "hadoop.proxyuser.bob.groups", "*")); HdfsProxyUserValidationTask task = new HdfsProxyUserValidationTask("hdfs: ValidationTaskResult result = task.validateImpl(ImmutableMap.of()); assertEquals(ValidationUtils.State.FAILED, result.getState()); assertThat(result.getResult(), containsString( "Alluxio is not able to perform impersonation.")); assertThat(result.getAdvice(), containsString( String.format("Please enable Alluxio user %s to impersonate", userName))); }
@Override public ValidationTaskResult validateImpl(Map<String, String> optionMap) { if (mConf.get(PropertyKey.SECURITY_AUTHENTICATION_TYPE) .equals(AuthType.NOSASL.getAuthName())) { return new ValidationTaskResult(ValidationUtils.State.SKIPPED, getName(), String.format("Impersonation validation is skipped for NOSASL"), ""); } ValidationTaskResult loadConfig = loadHdfsConfig(); if (loadConfig.getState() != ValidationUtils.State.OK) { return loadConfig; } try { String alluxioUser = getCurrentUser(); return validateProxyUsers(alluxioUser); } catch (UnauthenticatedException e) { mMsg.append(String.format("Failed to authenticate in Alluxio: ")); mMsg.append(ValidationUtils.getErrorInfo(e)); mAdvice.append("Please fix the authentication issue."); return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), mMsg.toString(), mAdvice.toString()); } }
HdfsProxyUserValidationTask extends HdfsConfValidationTask { @Override public ValidationTaskResult validateImpl(Map<String, String> optionMap) { if (mConf.get(PropertyKey.SECURITY_AUTHENTICATION_TYPE) .equals(AuthType.NOSASL.getAuthName())) { return new ValidationTaskResult(ValidationUtils.State.SKIPPED, getName(), String.format("Impersonation validation is skipped for NOSASL"), ""); } ValidationTaskResult loadConfig = loadHdfsConfig(); if (loadConfig.getState() != ValidationUtils.State.OK) { return loadConfig; } try { String alluxioUser = getCurrentUser(); return validateProxyUsers(alluxioUser); } catch (UnauthenticatedException e) { mMsg.append(String.format("Failed to authenticate in Alluxio: ")); mMsg.append(ValidationUtils.getErrorInfo(e)); mAdvice.append("Please fix the authentication issue."); return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), mMsg.toString(), mAdvice.toString()); } } }
HdfsProxyUserValidationTask extends HdfsConfValidationTask { @Override public ValidationTaskResult validateImpl(Map<String, String> optionMap) { if (mConf.get(PropertyKey.SECURITY_AUTHENTICATION_TYPE) .equals(AuthType.NOSASL.getAuthName())) { return new ValidationTaskResult(ValidationUtils.State.SKIPPED, getName(), String.format("Impersonation validation is skipped for NOSASL"), ""); } ValidationTaskResult loadConfig = loadHdfsConfig(); if (loadConfig.getState() != ValidationUtils.State.OK) { return loadConfig; } try { String alluxioUser = getCurrentUser(); return validateProxyUsers(alluxioUser); } catch (UnauthenticatedException e) { mMsg.append(String.format("Failed to authenticate in Alluxio: ")); mMsg.append(ValidationUtils.getErrorInfo(e)); mAdvice.append("Please fix the authentication issue."); return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), mMsg.toString(), mAdvice.toString()); } } HdfsProxyUserValidationTask(String path, AlluxioConfiguration conf); }
HdfsProxyUserValidationTask extends HdfsConfValidationTask { @Override public ValidationTaskResult validateImpl(Map<String, String> optionMap) { if (mConf.get(PropertyKey.SECURITY_AUTHENTICATION_TYPE) .equals(AuthType.NOSASL.getAuthName())) { return new ValidationTaskResult(ValidationUtils.State.SKIPPED, getName(), String.format("Impersonation validation is skipped for NOSASL"), ""); } ValidationTaskResult loadConfig = loadHdfsConfig(); if (loadConfig.getState() != ValidationUtils.State.OK) { return loadConfig; } try { String alluxioUser = getCurrentUser(); return validateProxyUsers(alluxioUser); } catch (UnauthenticatedException e) { mMsg.append(String.format("Failed to authenticate in Alluxio: ")); mMsg.append(ValidationUtils.getErrorInfo(e)); mAdvice.append("Please fix the authentication issue."); return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), mMsg.toString(), mAdvice.toString()); } } HdfsProxyUserValidationTask(String path, AlluxioConfiguration conf); @Override String getName(); @Override ValidationTaskResult validateImpl(Map<String, String> optionMap); }
HdfsProxyUserValidationTask extends HdfsConfValidationTask { @Override public ValidationTaskResult validateImpl(Map<String, String> optionMap) { if (mConf.get(PropertyKey.SECURITY_AUTHENTICATION_TYPE) .equals(AuthType.NOSASL.getAuthName())) { return new ValidationTaskResult(ValidationUtils.State.SKIPPED, getName(), String.format("Impersonation validation is skipped for NOSASL"), ""); } ValidationTaskResult loadConfig = loadHdfsConfig(); if (loadConfig.getState() != ValidationUtils.State.OK) { return loadConfig; } try { String alluxioUser = getCurrentUser(); return validateProxyUsers(alluxioUser); } catch (UnauthenticatedException e) { mMsg.append(String.format("Failed to authenticate in Alluxio: ")); mMsg.append(ValidationUtils.getErrorInfo(e)); mAdvice.append("Please fix the authentication issue."); return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), mMsg.toString(), mAdvice.toString()); } } HdfsProxyUserValidationTask(String path, AlluxioConfiguration conf); @Override String getName(); @Override ValidationTaskResult validateImpl(Map<String, String> optionMap);  }