@Test public void getJaasConfigForClientPrincipal() { Map<String, String> conf = new HashMap(); assertNull(SecurityUtils.getJaasConfigForClientPrincipal(conf)); conf.put(RANGER_LOOKUP_KEYTAB, "/tmp/rangerlookup.keytab"); assertNull(SecurityUtils.getJaasConfigForClientPrincipal(conf)); conf.put(RANGER_LOOKUP_PRINCIPAL, "rangerlookup"); String expected = "com.sun.security.auth.module.Krb5LoginModule" + " required useTicketCache=false principal=\"rangerlookup\" " + "useKeyTab=true keyTab=\"/tmp/rangerlookup.keytab\";"; String actual = SecurityUtils.getJaasConfigForClientPrincipal(conf); assertEquals(actual, expected); }
static String getJaasConfigForClientPrincipal(Map<String, ?> conf) { String keytabFile = (String)conf.get(RANGER_LOOKUP_KEYTAB); String principal = (String)conf.get(RANGER_LOOKUP_PRINCIPAL); if(keytabFile == null || keytabFile.isEmpty() || principal == null || principal.isEmpty()) { return null; } return "com.sun.security.auth.module.Krb5LoginModule required useTicketCache=false principal=\"" + principal + "\" useKeyTab=true keyTab=\"" + keytabFile + "\";"; }
SecurityUtils { static String getJaasConfigForClientPrincipal(Map<String, ?> conf) { String keytabFile = (String)conf.get(RANGER_LOOKUP_KEYTAB); String principal = (String)conf.get(RANGER_LOOKUP_PRINCIPAL); if(keytabFile == null || keytabFile.isEmpty() || principal == null || principal.isEmpty()) { return null; } return "com.sun.security.auth.module.Krb5LoginModule required useTicketCache=false principal=\"" + principal + "\" useKeyTab=true keyTab=\"" + keytabFile + "\";"; } }
SecurityUtils { static String getJaasConfigForClientPrincipal(Map<String, ?> conf) { String keytabFile = (String)conf.get(RANGER_LOOKUP_KEYTAB); String principal = (String)conf.get(RANGER_LOOKUP_PRINCIPAL); if(keytabFile == null || keytabFile.isEmpty() || principal == null || principal.isEmpty()) { return null; } return "com.sun.security.auth.module.Krb5LoginModule required useTicketCache=false principal=\"" + principal + "\" useKeyTab=true keyTab=\"" + keytabFile + "\";"; }  }
SecurityUtils { static String getJaasConfigForClientPrincipal(Map<String, ?> conf) { String keytabFile = (String)conf.get(RANGER_LOOKUP_KEYTAB); String principal = (String)conf.get(RANGER_LOOKUP_PRINCIPAL); if(keytabFile == null || keytabFile.isEmpty() || principal == null || principal.isEmpty()) { return null; } return "com.sun.security.auth.module.Krb5LoginModule required useTicketCache=false principal=\"" + principal + "\" useKeyTab=true keyTab=\"" + keytabFile + "\";"; }  static boolean isHttpsConnection(Map<String, ?> conf); static SSLContext createSSLContext(Map<String, ?> sslConfigurations, String sslAlgorithm); static Login initializeSecurityContext(Map<String, ?> conf); }
SecurityUtils { static String getJaasConfigForClientPrincipal(Map<String, ?> conf) { String keytabFile = (String)conf.get(RANGER_LOOKUP_KEYTAB); String principal = (String)conf.get(RANGER_LOOKUP_PRINCIPAL); if(keytabFile == null || keytabFile.isEmpty() || principal == null || principal.isEmpty()) { return null; } return "com.sun.security.auth.module.Krb5LoginModule required useTicketCache=false principal=\"" + principal + "\" useKeyTab=true keyTab=\"" + keytabFile + "\";"; }  static boolean isHttpsConnection(Map<String, ?> conf); static SSLContext createSSLContext(Map<String, ?> sslConfigurations, String sslAlgorithm); static Login initializeSecurityContext(Map<String, ?> conf);  }