本文整理汇总了Java中javax.security.auth.kerberos.KerberosPrincipal.KRB_NT_SRV_INST属性的典型用法代码示例。如果您正苦于以下问题:Java KerberosPrincipal.KRB_NT_SRV_INST属性的具体用法?Java KerberosPrincipal.KRB_NT_SRV_INST怎么用?Java KerberosPrincipal.KRB_NT_SRV_INST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.security.auth.kerberos.KerberosPrincipal
的用法示例。
在下文中一共展示了KerberosPrincipal.KRB_NT_SRV_INST属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: credsToTicket
public static KerberosTicket credsToTicket(Credentials serviceCreds) {
EncryptionKey sessionKey = serviceCreds.getSessionKey();
return new KerberosTicket(
serviceCreds.getEncoded(),
new KerberosPrincipal(serviceCreds.getClient().getName()),
new KerberosPrincipal(serviceCreds.getServer().getName(),
KerberosPrincipal.KRB_NT_SRV_INST),
sessionKey.getBytes(),
sessionKey.getEType(),
serviceCreds.getFlags(),
serviceCreds.getAuthTime(),
serviceCreds.getStartTime(),
serviceCreds.getEndTime(),
serviceCreds.getRenewTill(),
serviceCreds.getClientAddresses());
}
示例2: main
public static void main(String[] args) throws Exception {
new OneKDC(null).writeJAASConf();
Context c = Context.fromJAAS("client");
Context s = Context.fromThinAir();
KerberosPrincipal kp = new KerberosPrincipal(
OneKDC.SERVER + "@" + OneKDC.REALM,
KerberosPrincipal.KRB_NT_SRV_INST);
s.s().getPrincipals().add(kp);
for (KerberosKey k: KeyTab.getInstance(kp).getKeys(kp)) {
s.s().getPrivateCredentials().add(k);
}
c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
s.startAsServer(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
Context.handshake(c, s);
}
示例3: main
public static void main(String[] args)
throws Exception {
OneKDC kdc = new OneKDC(null);
kdc.writeJAASConf();
String extraLine;
switch (args[0]) {
case "1": extraLine = "noaddresses = false"; break;
case "2": extraLine = "noaddresses = true"; break;
default: extraLine = ""; break;
}
KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
extraLine);
Config.refresh();
Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
Set<KerberosTicket> tickets =
c.s().getPrivateCredentials(KerberosTicket.class);
if (tickets.isEmpty()) throw new Exception();
KerberosTicket ticket = tickets.iterator().next();
InetAddress[] addresses = ticket.getClientAddresses();
switch (args[0]) {
case "1":
if (addresses == null || addresses.length == 0) {
throw new Exception("No addresses");
}
if (ticket.getServer().getNameType()
!= KerberosPrincipal.KRB_NT_SRV_INST) {
throw new Exception(
"Wrong type: " + ticket.getServer().getNameType());
}
break;
default:
if (addresses != null && addresses.length != 0) {
throw new Exception("See addresses");
}
break;
}
}