当前位置: 首页>>代码示例>>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;未经允许,请勿转载。