@Override public void initialize(AuthorizationContext context) throws Exception { this.properties = context.getExtensionProperties(); }
@Override public void initialize(AuthorizationContext context) throws Exception { Properties properties = context.getExtensionProperties(); String sentrySiteUrl = properties.getProperty(AuthConf.SENTRY_SITE_URL); Preconditions.checkArgument(!Strings.isNullOrEmpty(AuthConf.SENTRY_SITE_URL), "Path to sentry-site.xml path is not specified in cdap-site.xml. Please provide the " + "path to sentry-site.xml in cdap-site.xml with property name %s", AuthConf.SENTRY_SITE_URL); String sentryAdminGroup = properties.getProperty(AuthConf.SENTRY_ADMIN_GROUP, AuthConf.AuthzConfVars.AUTHZ_SENTRY_ADMIN_GROUP.getDefault()); Preconditions.checkArgument(!sentryAdminGroup.contains(","), "Please provide exactly one Sentry admin group at %s in cdap-site.xml. Found '%s'.", AuthConf.SENTRY_ADMIN_GROUP, sentryAdminGroup); String instanceName = properties.containsKey(AuthConf.INSTANCE_NAME) ? properties.getProperty(AuthConf.INSTANCE_NAME) : AuthConf.AuthzConfVars.getDefault(AuthConf.INSTANCE_NAME); int cacheTtlSecs = Integer.parseInt(properties.getProperty(AuthConf.CACHE_TTL_SECS, AuthConf.CACHE_TTL_SECS_DEFAULT)); int cacheMaxEntries = Integer.parseInt(properties.getProperty(AuthConf.CACHE_MAX_ENTRIES, AuthConf.CACHE_MAX_ENTRIES_DEFAULT)); LOG.info("Configuring SentryAuthorizer with sentry-site.xml at {}, CDAP instance {} and Sentry Admin Group: {}", sentrySiteUrl, instanceName, sentryAdminGroup); this.binding = new AuthBinding(sentrySiteUrl, instanceName, sentryAdminGroup, cacheTtlSecs, cacheMaxEntries); this.context = context; }
@Override public void initialize(AuthorizationContext context) throws Exception { Properties properties = context.getExtensionProperties(); if (properties.containsKey("superusers")) { for (String superuser : Splitter.on(",").trimResults().omitEmptyStrings() .split(properties.getProperty("superusers"))) { superUsers.add(new Principal(superuser, Principal.PrincipalType.USER)); } } }