15 package com.cloudera.impala.authorization;
18 import org.apache.sentry.provider.common.HadoopGroupResourceAuthorizationProvider;
19 import org.apache.sentry.provider.common.ResourceAuthorizationProvider;
21 import com.google.common.base.Preconditions;
22 import com.google.common.base.Strings;
43 String sentryConfigFile, String policyProviderClassName) {
47 if (!Strings.isNullOrEmpty(policyProviderClassName)) {
48 policyProviderClassName = policyProviderClassName.trim();
65 String policyFile, String sentryConfigFile) {
67 HadoopGroupResourceAuthorizationProvider.class.getName());
81 sentryConfig_.loadConfig();
85 throw new IllegalArgumentException(
86 "Authorization is enabled but the server name is null or empty. Set the " +
87 "server name using the impalad --server_name flag.");
90 throw new IllegalArgumentException(
"Authorization is enabled but the " +
91 "authorization policy provider class name is null or empty. Set the class " +
92 "name using the --authorization_policy_provider_class impalad flag.");
95 Class<?> providerClass = null;
99 this.getClass().getClassLoader());
100 }
catch (ClassNotFoundException e) {
101 throw new IllegalArgumentException(String.format(
"The authorization policy " +
104 Preconditions.checkNotNull(providerClass);
105 if (!ResourceAuthorizationProvider.class.isAssignableFrom(providerClass)) {
106 throw new IllegalArgumentException(String.format(
"The authorization policy " +
107 "provider class '%s' must be a subclass of '%s'.",
109 ResourceAuthorizationProvider.class.getName()));
120 !Strings.isNullOrEmpty(sentryConfig_.getConfigFile());
SentryConfig getSentryConfig()
static AuthorizationConfig createHadoopGroupAuthConfig(String serverName, String policyFile, String sentryConfigFile)
final String policyProviderClassName_
static AuthorizationConfig createAuthDisabledConfig()
final SentryConfig sentryConfig_
AuthorizationConfig(String serverName, String policyFile, String sentryConfigFile, String policyProviderClassName)
String getPolicyProviderClassName()
boolean isFileBasedPolicy()