SecurityUtils { static boolean isKerberosEnabled(Map<String, ?> conf) { String rangerAuthType = (String) conf.get(RANGER_AUTH_TYPE); String pluginAuthType = (String) conf.get("schema-registry.authentication"); return rangerAuthType != null && pluginAuthType != null && rangerAuthType.equals(HADOOP_SECURITY_AUTHENTICATION_METHOD) && pluginAuthType.equalsIgnoreCase(HADOOP_SECURITY_AUTHENTICATION_METHOD); }  static boolean isHttpsConnection(Map<String, ?> conf); static SSLContext createSSLContext(Map<String, ?> sslConfigurations, String sslAlgorithm); static Login initializeSecurityContext(Map<String, ?> conf);  }
@Test public void isKerberosEnabled() { Map<String, String> conf = new HashMap(); conf.put(RANGER_AUTH_TYPE, "kerberos"); conf.put("schema-registry.authentication", "kerberos"); assertTrue(SecurityUtils.isKerberosEnabled(conf)); conf = new HashMap(); assertFalse(SecurityUtils.isKerberosEnabled(conf)); conf = new HashMap(); conf.put(RANGER_AUTH_TYPE, "kerberos"); assertFalse(SecurityUtils.isKerberosEnabled(conf)); conf = new HashMap(); conf.put("schema-registry.authentication", "kerberos"); assertFalse(SecurityUtils.isKerberosEnabled(conf)); conf = new HashMap(); conf.put(RANGER_AUTH_TYPE, "kerberos"); conf.put("schema-registry.authentication", "Something wrong"); assertFalse(SecurityUtils.isKerberosEnabled(conf)); conf = new HashMap(); conf.put("schema-registry.authentication", "kerberos"); conf.put(RANGER_AUTH_TYPE, "Something wrong"); assertFalse(SecurityUtils.isKerberosEnabled(conf)); }