當前位置: 首頁>>代碼示例>>Java>>正文


Java KerberosTicket.getClient方法代碼示例

本文整理匯總了Java中javax.security.auth.kerberos.KerberosTicket.getClient方法的典型用法代碼示例。如果您正苦於以下問題:Java KerberosTicket.getClient方法的具體用法?Java KerberosTicket.getClient怎麽用?Java KerberosTicket.getClient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.security.auth.kerberos.KerberosTicket的用法示例。


在下文中一共展示了KerberosTicket.getClient方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import javax.security.auth.kerberos.KerberosTicket; //導入方法依賴的package包/類
/**
 * Creates an instance of KerberosClientKeyExchange consisting of the
 * Kerberos service ticket, authenticator and encrypted premaster secret.
 * Called by client handshaker.
 *
 * @param serverName name of server with which to do handshake;
 *             this is used to get the Kerberos service ticket
 * @param protocolVersion Maximum version supported by client (i.e,
 *          version it requested in client hello)
 * @param rand random number generator to use for generating pre-master
 *          secret
 */
@Override
public void init(String serverName,
    AccessControlContext acc, ProtocolVersion protocolVersion,
    SecureRandom rand) throws IOException {

     // Get service ticket
     KerberosTicket ticket = getServiceTicket(serverName, acc);
     encodedTicket = ticket.getEncoded();

     // Record the Kerberos principals
     peerPrincipal = ticket.getServer();
     localPrincipal = ticket.getClient();

     // Optional authenticator, encrypted using session key,
     // currently ignored

     // Generate premaster secret and encrypt it using session key
     EncryptionKey sessionKey = new EncryptionKey(
                                    ticket.getSessionKeyType(),
                                    ticket.getSessionKey().getEncoded());

     preMaster = new KerberosPreMasterSecret(protocolVersion,
         rand, sessionKey);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:37,代碼來源:KerberosClientKeyExchangeImpl.java

示例2: ExchangerImpl

import javax.security.auth.kerberos.KerberosTicket; //導入方法依賴的package包/類
ExchangerImpl(String serverName, AccessControlContext acc,
        ProtocolVersion protocolVersion, SecureRandom rand) throws IOException {

    // Get service ticket
    KerberosTicket ticket = getServiceTicket(serverName, acc);
    encodedTicket = ticket.getEncoded();

    // Record the Kerberos principals
    peerPrincipal = ticket.getServer();
    localPrincipal = ticket.getClient();

    // Optional authenticator, encrypted using session key,
    // currently ignored

    // Generate premaster secret and encrypt it using session key
    EncryptionKey sessionKey = new EncryptionKey(
            ticket.getSessionKeyType(),
            ticket.getSessionKey().getEncoded());

    preMaster = new KerberosPreMasterSecret(protocolVersion,
            rand, sessionKey);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:Krb5KeyExchangeService.java

示例3: init

import javax.security.auth.kerberos.KerberosTicket; //導入方法依賴的package包/類
/**
 * Creates an instance of KerberosClientKeyExchange consisting of the
 * Kerberos service ticket, authenticator and encrypted premaster secret.
 * Called by client handshaker.
 *
 * @param serverName name of server with which to do handshake;
 *             this is used to get the Kerberos service ticket
 * @param protocolVersion Maximum version supported by client (i.e,
 *          version it requested in client hello)
 * @param rand random number generator to use for generating pre-master
 *          secret
 */
@Override
public void init(String serverName, boolean isLoopback,
    AccessControlContext acc, ProtocolVersion protocolVersion,
    SecureRandom rand) throws IOException {

     // Get service ticket
     KerberosTicket ticket = getServiceTicket(serverName, isLoopback, acc);
     encodedTicket = ticket.getEncoded();

     // Record the Kerberos principals
     peerPrincipal = ticket.getServer();
     localPrincipal = ticket.getClient();

     // Optional authenticator, encrypted using session key,
     // currently ignored

     // Generate premaster secret and encrypt it using session key
     EncryptionKey sessionKey = new EncryptionKey(
                                    ticket.getSessionKeyType(),
                                    ticket.getSessionKey().getEncoded());

     preMaster = new KerberosPreMasterSecret(protocolVersion,
         rand, sessionKey);
}
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:37,代碼來源:KerberosClientKeyExchangeImpl.java

示例4: getInstance

import javax.security.auth.kerberos.KerberosTicket; //導入方法依賴的package包/類
static Krb5InitCredential getInstance(GSSCaller caller, Krb5NameElement name,
                               int initLifetime)
    throws GSSException {

    KerberosTicket tgt = getTgt(caller, name, initLifetime);
    if (tgt == null)
        throw new GSSException(GSSException.NO_CRED, -1,
                               "Failed to find any Kerberos tgt");

    if (name == null) {
        String fullName = tgt.getClient().getName();
        name = Krb5NameElement.getInstance(fullName,
                                   Krb5MechFactory.NT_GSS_KRB5_PRINCIPAL);
    }

    return new Krb5InitCredential(name,
                                  tgt.getEncoded(),
                                  tgt.getClient(),
                                  tgt.getServer(),
                                  tgt.getSessionKey().getEncoded(),
                                  tgt.getSessionKeyType(),
                                  tgt.getFlags(),
                                  tgt.getAuthTime(),
                                  tgt.getStartTime(),
                                  tgt.getEndTime(),
                                  tgt.getRenewTill(),
                                  tgt.getClientAddresses());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:Krb5InitCredential.java

示例5: initLoginContext

import javax.security.auth.kerberos.KerberosTicket; //導入方法依賴的package包/類
private synchronized void initLoginContext() {
    if (loggedIn) {
        return;
    }

    try {
        LoginCallbackHandler callback = new LoginCallbackHandler(config.getSsoJaasPrincipalPassword());
        loginContext = new LoginContext(config.getSsoJaasConfigName(), callback);
        loginContext.login();

        loggedIn = true;

        Subject serviceSubject = loginContext.getSubject();

        for (KerberosTicket ticket : serviceSubject.getPrivateCredentials(KerberosTicket.class)) {
            log.info("AuthTime: " + ticket.getAuthTime());
            log.info("StartTime: " + ticket.getStartTime());
            log.info("EndTime: " + ticket.getEndTime());
            log.info("RenewTill: " + ticket.getRenewTill());

            KerberosPrincipal client = ticket.getClient();
            log.info("Client: name=" + client.getName() + ", realm=" + client.getRealm());

            KerberosPrincipal server = ticket.getServer();
            log.info("Server: name=" + server.getName() + ", realm=" + server.getRealm());
        }

    } catch (LoginException ex) {
        log.error(ex.getMessage(), ex);
    }
}
 
開發者ID:imCodePartnerAB,項目名稱:imcms,代碼行數:32,代碼來源:KerberosLoginService.java


注:本文中的javax.security.auth.kerberos.KerberosTicket.getClient方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。