org.apache.flink.runtime.security.modules.HadoopModuleFactory Java Examples

The following examples show how to use org.apache.flink.runtime.security.modules.HadoopModuleFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HadoopSecurityContextFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
@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;
	}
}