KMSAuthenticationFilter extends DelegationTokenAuthenticationFilter { @VisibleForTesting Properties getKMSConfiguration(Configuration conf) { Properties props = new Properties(); Map<String, String> propsWithPrefixMap = conf.getPropsWithPrefix( CONFIG_PREFIX); for (Map.Entry<String, String> entry : propsWithPrefixMap.entrySet()) { props.setProperty(entry.getKey(), entry.getValue()); } String authType = props.getProperty(AUTH_TYPE); if (authType.equals(PseudoAuthenticationHandler.TYPE)) { props.setProperty(AUTH_TYPE, PseudoDelegationTokenAuthenticationHandler.class.getName()); } else if (authType.equals(KerberosAuthenticationHandler.TYPE)) { props.setProperty(AUTH_TYPE, KerberosDelegationTokenAuthenticationHandler.class.getName()); } props.setProperty(DelegationTokenAuthenticationHandler.TOKEN_KIND, KMSDelegationToken.TOKEN_KIND_STR); return props; }  @Override void doFilter(ServletRequest request, ServletResponse response,
      FilterChain filterChain); static final String CONFIG_PREFIX; }
@Test public void testConfiguration() throws Exception { Configuration conf = new Configuration(); conf.set("hadoop.kms.authentication.type", "simple"); Properties prop = new KMSAuthenticationFilter().getKMSConfiguration(conf); assertEquals(prop.getProperty(KMSAuthenticationFilter.AUTH_TYPE), PseudoDelegationTokenAuthenticationHandler.class.getName()); assertEquals( prop.getProperty(DelegationTokenAuthenticationHandler.TOKEN_KIND), KMSDelegationToken.TOKEN_KIND_STR); }