@Override
public boolean isCompatibleWith(SecurityConfiguration securityConfig) {
// not compatible if no hadoop module factory configured.
if (!securityConfig.getSecurityModuleFactories().contains(HadoopModuleFactory.class.getCanonicalName())) {
return false;
}
// not compatible if Hadoop binary not in classpath.
try {
Class.forName(
"org.apache.hadoop.security.UserGroupInformation",
false,
HadoopSecurityContextFactory.class.getClassLoader());
return true;
} catch (ClassNotFoundException e) {
LOG.info("Cannot install HadoopSecurityContext because Hadoop cannot be found in the Classpath.");
return false;
}
}