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


Java GSSName.equals方法代碼示例

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


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

示例1: authorize

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
/**
 * Performs host authentication. The hostname of the peer is
 * compared with the hostname specified in the peer's (topmost) 
 * certificate in the certificate chain. The hostnames must
 * match exactly (in case-insensitive way)
 *
 * @param context the security context
 * @param host host address of the peer.
 * @exception AuthorizationException if the hostnames
 *            do not match.
 */
public void authorize(GSSContext context, String host)
    throws AuthorizationException {
    logger.debug("Authorization: HOST");

    try {
        GSSName expected = getExpectedName(null, host);
    
        GSSName target = null;
        if (context.isInitiator()) {
            target = context.getTargName();
        } else {
            target = context.getSrcName();
        }
    
        if (!expected.equals(target)) {
            generateAuthorizationException(expected, target);
        }
    } catch (GSSException e) {
        throw new AuthorizationException("Authorization failure", e);
    }
}
 
開發者ID:NCIP,項目名稱:cagrid-general,代碼行數:33,代碼來源:HostAuthorization.java

示例2: authorize

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
/**
 * Performs identity authorization. The given identity is compared
 * with the peer's identity.
 *
 * @param context the security context
 * @param host host address of the peer.
 * @exception AuthorizationException if the peer's
 *            identity does not match the expected identity.
 */
public void authorize(GSSContext context, String host)
    throws AuthorizationException {
    logger.debug("Authorization: IDENTITY");

    try {
        GSSName expected = getExpectedName(null, host);
    
        GSSName target = null;
        if (context.isInitiator()) {
            target = context.getTargName();
        } else {
            target = context.getSrcName();
        }
        
        if (!expected.equals(target)) {
            generateAuthorizationException(expected, target);
        }
    } catch (GSSException e) {
        throw new AuthorizationException("Authorization failure", e);
    }
}
 
開發者ID:NCIP,項目名稱:cagrid-general,代碼行數:31,代碼來源:IdentityAuthorization.java

示例3: go

import org.ietf.jgss.GSSName; //導入方法依賴的package包/類
void go(final String server, final String backend) throws Exception {
    Context c, s, s2, b;
    c = Context.fromJAAS("client");
    s = Context.fromJAAS("server");
    b = Context.fromJAAS("backend");

    c.startAsClient(server, GSSUtil.GSS_KRB5_MECH_OID);
    c.x().requestCredDeleg(true);
    c.x().requestConf(conf);
    s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);

    c.status();
    s.status();

    Context.handshake(c, s);
    GSSName client = c.x().getSrcName();

    c.status();
    s.status();

    Context.transmit("i say high --", c, s);
    Context.transmit("   you say low", s, c);

    s2 = s.delegated();
    s.dispose();
    s = null;

    s2.startAsClient(backend, GSSUtil.GSS_KRB5_MECH_OID);
    s2.x().requestConf(conf);
    b.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);

    s2.status();
    b.status();

    Context.handshake(s2, b);
    GSSName client2 = b.x().getSrcName();

    if (!client.equals(client2)) {
        throw new Exception("Delegation failed");
    }

    s2.status();
    b.status();

    Context.transmit("you say hello --", s2, b);
    Context.transmit("   i say goodbye", b, s2);

    s2.dispose();
    b.dispose();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:51,代碼來源:BasicKrb5Test.java


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