@Test public void testKeytab() { assertThat(keytab).isNotNull(); List<PrincipalName> principals = keytab.getPrincipals(); PrincipalName principal = principals.get(0); List<KeytabEntry> entries = keytab.getKeytabEntries(principal); for (KeytabEntry ke : entries) { assertThat(ke.getKvno() == 1).isTrue(); } }
public static void main(String[] args) throws IOException { InputStream kis = KeytabTest.class.getResourceAsStream("test.keytab"); Keytab keytab = Keytab.loadKeytab(kis); System.out.println("Principals:" + keytab.getPrincipals().size()); }