use of org.apache.kerby.kerberos.kerb.client.KrbPkinitClient in project testcases by coheigea.
the class AnonymousPKInitTest method unitTest.
@org.junit.Test
public void unitTest() throws Exception {
KrbPkinitClient client = new KrbPkinitClient();
client.setKdcHost("localhost");
client.setKdcTcpPort(kerbyServer.getKdcPort());
client.setAllowUdp(false);
// client.setKdcUdpPort(Integer.parseInt(KDC_UDP_PORT));
client.setKdcRealm(kerbyServer.getKdcSetting().getKdcRealm());
// client.getKrbConfig().setString(KrbConfigKey.PKINIT_ANCHORS, "myclient.cer");
String pkinitAnchors = AnonymousPKInitTest.class.getResource("/cacerttest.pem").getPath();
client.getKrbConfig().setString(KrbConfigKey.PKINIT_ANCHORS, pkinitAnchors);
client.init();
try {
TgtTicket tgt = client.requestTgt();
assertTrue(tgt != null);
SgtTicket tkt = client.requestSgt(tgt, "bob/service.ws.apache.org@service.ws.apache.org");
assertTrue(tkt != null);
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
Aggregations