// get client's password
PasswordCallback callback = new PasswordCallback("Password for "
+ name, false);
callbackHandler.handle(new Callback[] { callback });
KDCReply reply = KrbClient.doAS(cname, callback.getPassword());
// add principal to subject
String[] pName = reply.getCname().getName();
StringBuilder buf = new StringBuilder();
for (int i = 0; i < pName.length - 1; i++) {
buf.append(pName[i]);
buf.append('/');
}
buf.append(pName[pName.length - 1]);
buf.append('@');
buf.append(reply.getCrealm());
client = new KerberosPrincipal(buf.toString(), reply.getCname()
.getType());
// add ticket to private credentials
byte[] ticket = reply.getTicket().getEncoded();
String[] sName = reply.getSname().getName();
buf = new StringBuilder();
for (int i = 0; i < sName.length - 1; i++) {
buf.append(sName[i]);
buf.append('/');
}
buf.append(sName[sName.length - 1]);
buf.append('@');
buf.append(reply.getSrealm());
KerberosPrincipal server = new KerberosPrincipal(buf.toString(),
reply.getSname().getType());
int keyType = reply.getKey().getType();
byte[] sessionKey = reply.getKey().getValue();
boolean[] flags = reply.getFlags().toBooleanArray();
krbTicket = new KerberosTicket(ticket, client, server, sessionKey,
keyType, flags, reply.getAuthtime(), reply.getStarttime(),
reply.getEndtime(), reply.getRenewtill(),
//TODO InetAddress[] clientAddresses
null);
return true; //FIXME
} catch (Exception e) {