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


Java KerberosTicket.isForwardable方法代碼示例

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


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

示例1: populateCredentials

import javax.security.auth.kerberos.KerberosTicket; //導入方法依賴的package包/類
@Override
public void populateCredentials(Map<String, String> credentials) {
    // Log the user in and get the TGT
    try {
        Configuration login_conf = AuthUtils.GetConfiguration(conf);
        ClientCallbackHandler client_callback_handler = new ClientCallbackHandler(login_conf);

        // login our user
        Configuration.setConfiguration(login_conf);
        LoginContext lc = new LoginContext(AuthUtils.LOGIN_CONTEXT_CLIENT, client_callback_handler);
        try {
            lc.login();
            final Subject subject = lc.getSubject();
            KerberosTicket tgt = getTGT(subject);

            if (tgt == null) { // error
                throw new RuntimeException("Fail to verify user principal with section \"" + AuthUtils.LOGIN_CONTEXT_CLIENT
                        + "\" in login configuration file " + login_conf);
            }

            if (!tgt.isForwardable()) {
                throw new RuntimeException("The TGT found is not forwardable");
            }

            if (!tgt.isRenewable()) {
                throw new RuntimeException("The TGT found is not renewable");
            }

            LOG.info("Pushing TGT for " + tgt.getClient() + " to topology.");
            saveTGT(tgt, credentials);
        } finally {
            lc.logout();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:kkllwww007,項目名稱:jstrom,代碼行數:38,代碼來源:AutoTGT.java


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