當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。