当前位置: 首页>>代码示例>>Java>>正文


Java KerberosPrincipal.KRB_NT_SRV_INST属性代码示例

本文整理汇总了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());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:Krb5Util.java

示例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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:KPEquals.java

示例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;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:43,代码来源:AddressesAndNameType.java


注:本文中的javax.security.auth.kerberos.KerberosPrincipal.KRB_NT_SRV_INST属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。