Java Code Examples for org.apache.hadoop.http.FilterContainer#addFilter()
The following examples show how to use
org.apache.hadoop.http.FilterContainer#addFilter() .
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: StramWSFilterInitializer.java From Bats with Apache License 2.0 | 5 votes |
@Override public void initFilter(FilterContainer container, Configuration conf) { logger.debug("Conf {}", conf); Map<String, String> params = new HashMap<>(); Collection<String> proxies = new ArrayList<>(); if (ConfigUtils.isRMHAEnabled(conf)) { // HA is enabled get all for (String rmId : ConfigUtils.getRMHAIds(conf)) { proxies.add(getResolvedRMWebAppURLWithoutScheme(conf, rmId)); } logger.info("HA proxy addresses {}", proxies); } if (proxies.isEmpty()) { proxies.add(getProxyHostAndPort(conf)); logger.info("Proxy addresses {}", proxies); } StringBuilder proxyBr = new StringBuilder(); for (String proxy : proxies) { if (proxyBr.length() != 0) { proxyBr.append(StramWSFilter.PROXY_DELIMITER); } String[] parts = proxy.split(":"); proxyBr.append(parts[0]); } params.put(StramWSFilter.PROXY_HOST, proxyBr.toString()); container.addFilter(FILTER_NAME, FILTER_CLASS, params); }
Example 2
Source File: RMAuthenticationFilterInitializer.java From hadoop with Apache License 2.0 | 5 votes |
@Override public void initFilter(FilterContainer container, Configuration conf) { Map<String, String> filterConfig = createFilterConfig(conf); container.addFilter("RMAuthenticationFilter", RMAuthenticationFilter.class.getName(), filterConfig); }
Example 3
Source File: StaticUserWebFilter.java From hadoop with Apache License 2.0 | 5 votes |
@Override public void initFilter(FilterContainer container, Configuration conf) { HashMap<String, String> options = new HashMap<String, String>(); String username = getUsernameFromConf(conf); options.put(HADOOP_HTTP_STATIC_USER, username); container.addFilter("static_user_filter", StaticUserFilter.class.getName(), options); }
Example 4
Source File: RMAuthenticationFilterInitializer.java From big-c with Apache License 2.0 | 5 votes |
@Override public void initFilter(FilterContainer container, Configuration conf) { Map<String, String> filterConfig = createFilterConfig(conf); container.addFilter("RMAuthenticationFilter", RMAuthenticationFilter.class.getName(), filterConfig); }
Example 5
Source File: StaticUserWebFilter.java From big-c with Apache License 2.0 | 5 votes |
@Override public void initFilter(FilterContainer container, Configuration conf) { HashMap<String, String> options = new HashMap<String, String>(); String username = getUsernameFromConf(conf); options.put(HADOOP_HTTP_STATIC_USER, username); container.addFilter("static_user_filter", StaticUserFilter.class.getName(), options); }
Example 6
Source File: StramWSFilterInitializer.java From attic-apex-core with Apache License 2.0 | 5 votes |
@Override public void initFilter(FilterContainer container, Configuration conf) { logger.debug("Conf {}", conf); Map<String, String> params = new HashMap<>(); Collection<String> proxies = new ArrayList<>(); if (ConfigUtils.isRMHAEnabled(conf)) { // HA is enabled get all for (String rmId : ConfigUtils.getRMHAIds(conf)) { proxies.add(getResolvedRMWebAppURLWithoutScheme(conf, rmId)); } logger.info("HA proxy addresses {}", proxies); } if (proxies.isEmpty()) { proxies.add(getProxyHostAndPort(conf)); logger.info("Proxy addresses {}", proxies); } StringBuilder proxyBr = new StringBuilder(); for (String proxy : proxies) { if (proxyBr.length() != 0) { proxyBr.append(StramWSFilter.PROXY_DELIMITER); } String[] parts = proxy.split(":"); proxyBr.append(parts[0]); } params.put(StramWSFilter.PROXY_HOST, proxyBr.toString()); container.addFilter(FILTER_NAME, FILTER_CLASS, params); }
Example 7
Source File: AuthenticationFilterInitializer.java From hadoop with Apache License 2.0 | 3 votes |
/** * Initializes hadoop-auth AuthenticationFilter. * <p/> * Propagates to hadoop-auth AuthenticationFilter configuration all Hadoop * configuration properties prefixed with "hadoop.http.authentication." * * @param container The filter container * @param conf Configuration for run-time parameters */ @Override public void initFilter(FilterContainer container, Configuration conf) { Map<String, String> filterConfig = getFilterConfigMap(conf, PREFIX); container.addFilter("authentication", AuthenticationFilter.class.getName(), filterConfig); }
Example 8
Source File: AuthenticationFilterInitializer.java From big-c with Apache License 2.0 | 3 votes |
/** * Initializes hadoop-auth AuthenticationFilter. * <p/> * Propagates to hadoop-auth AuthenticationFilter configuration all Hadoop * configuration properties prefixed with "hadoop.http.authentication." * * @param container The filter container * @param conf Configuration for run-time parameters */ @Override public void initFilter(FilterContainer container, Configuration conf) { Map<String, String> filterConfig = getFilterConfigMap(conf, PREFIX); container.addFilter("authentication", AuthenticationFilter.class.getName(), filterConfig); }