Krb5ServerHelper { public Identity getClientIdentity(byte[] serviceTicket){ try { DerValue APREQ = extractAPREQ(serviceTicket); Ticket authenticationTicket = extractAuthenticationTicketFromAPREQ(APREQ.toDerInputStream(), APREQ.length()); Identity identity = decryptAuthenticationTicket(authenticationTicket); return identity; } catch (Exception e) { return null; } } Krb5ServerHelper(String servicePrincipalName, String serviceAccount, String keytab);  Krb5ServerHelper(String servicePrincipalName, Subject serverSubject); String authenticateClient(byte[] serviceTicket); Identity getClientIdentity(byte[] serviceTicket); static EncryptionKey getServerPrivateKey(Subject subject, int keyType);  }
@Test public void getClientDetails() throws Exception{ Identity clientIdentity = krb5ServerHelper.getClientIdentity(serviceTicket); System.out.println(clientIdentity.toString()); assertEquals("Username - Expected: " + clientUsername + " Actual: " + clientIdentity.getUsername(), clientUsername, clientIdentity.getUsername()); assertEquals("Realm - Expected: " + clientDomain + " Actual: " + clientIdentity.getRealm(), clientDomain, clientIdentity.getRealm()); assertNotNull("Full name: " + clientIdentity.getAttribute("fullName"), clientIdentity.getAttribute("fullName")); assertNotNull("Authentication time: " + clientIdentity.getAuthenticationDateTime().toString(), clientIdentity.getAuthenticationDateTime()); assertTrue("End time: " + ((Date)clientIdentity.getAttribute("endTime")).toString(), ((Date)clientIdentity.getAttribute("endTime")).after(new Date())); assertNotNull(clientIdentity.getAttribute("clientAddress")); assertNotNull(clientIdentity.getAttribute("pac")); }