当前位置: 首页>>代码示例>>Java>>正文


Java Oid.equals方法代码示例

本文整理汇总了Java中org.ietf.jgss.Oid.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Oid.equals方法的具体用法?Java Oid.equals怎么用?Java Oid.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ietf.jgss.Oid的用法示例。


在下文中一共展示了Oid.equals方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LoginConfigImpl

import org.ietf.jgss.Oid; //导入方法依赖的package包/类
/**
 * A new instance of LoginConfigImpl must be created for each login request
 * since it's only used by a single (caller, mech) pair
 * @param caller defined in GSSUtil as CALLER_XXX final fields
 * @param oid defined in GSSUtil as XXX_MECH_OID final fields
 */
public LoginConfigImpl(GSSCaller caller, Oid mech) {

    this.caller = caller;

    if (mech.equals(GSSUtil.GSS_KRB5_MECH_OID)) {
        mechName = "krb5";
    } else {
        throw new IllegalArgumentException(mech.toString() + " not supported");
    }
    config = java.security.AccessController.doPrivileged
            (new java.security.PrivilegedAction <Configuration> () {
        public Configuration run() {
            return Configuration.getConfiguration();
        }
    });
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:LoginConfigImpl.java

示例2: LoginConfigImpl

import org.ietf.jgss.Oid; //导入方法依赖的package包/类
/**
 * A new instance of LoginConfigImpl must be created for each login request
 * since it's only used by a single (caller, mech) pair
 * @param caller defined in GSSUtil as CALLER_XXX final fields
 * @param mech defined in GSSUtil as XXX_MECH_OID final fields
 */
public LoginConfigImpl(GSSCaller caller, Oid mech) {

    this.caller = caller;

    if (mech.equals(GSSUtil.GSS_KRB5_MECH_OID)) {
        mechName = "krb5";
    } else {
        throw new IllegalArgumentException(mech.toString() + " not supported");
    }
    config = java.security.AccessController.doPrivileged
            (new java.security.PrivilegedAction <Configuration> () {
        public Configuration run() {
            return Configuration.getConfiguration();
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:LoginConfigImpl.java

示例3: KerberosName

import org.ietf.jgss.Oid; //导入方法依赖的package包/类
public KerberosName(String name, Oid nameType) throws GSSException {
	if (null == name) {
		throw new GSSException(KerberosUtils.DEFAULT_GSSEXCEPTION_MAJOR_CODE,
				KerberosUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE,
				"Cannot import null GSSName");
	}

	if (null == nameType) {
		nameType = KerberosUtils.KRB5_PRINCIPAL_NAMETYPE;
	}
	
	if(nameType.equals(GSSName.NT_HOSTBASED_SERVICE)){
		name = name.replaceAll("@", "/");
	}
	
	if (!(nameType.equals(GSSName.NT_HOSTBASED_SERVICE)
			|| nameType.equals(GSSName.NT_USER_NAME) || nameType
			.equals(KerberosUtils.KRB5_PRINCIPAL_NAMETYPE))) {
		throw new GSSException(
				KerberosUtils.DEFAULT_GSSEXCEPTION_MAJOR_CODE,
				KerberosUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE,
				"Unsupported OID");
	}
	this.name = name;
	this.nameType = nameType;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:KerberosName.java

示例4: getMechsForName

import org.ietf.jgss.Oid; //导入方法依赖的package包/类
@Override
public Oid[] getMechsForName(Oid nameType) {
	ArrayList<Oid> mechs = new ArrayList<Oid>();
	Oid[] oids = getMechs();
	for (Oid oid : oids) {
		GSSMechSpi api = spis.get(oid);
		Oid[] mechNames = api.getNameMechs();
		boolean support = false;
		for (Oid mechName : mechNames) {
			if (mechName.equals(nameType)) {
				support = true;
				break;
			}
		}
		if (support) {
			mechs.add(oid);
		}
	}
	return mechs.toArray(new Oid[mechs.size()]);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:GSSManagerImpl.java

示例5: testGetNamesForMech

import org.ietf.jgss.Oid; //导入方法依赖的package包/类
public void testGetNamesForMech() throws Exception {
	Oid kerberosMech = new Oid("1.2.840.113554.1.2.2");
	Oid[] nameTypes = gssManager.getNamesForMech(kerberosMech);
	Oid[] expectedNameTypes = new Oid[] { GSSName.NT_USER_NAME,
			GSSName.NT_HOSTBASED_SERVICE, GSSName.NT_EXPORT_NAME,
			KerberosUtils.KRB5_PRINCIPAL_NAMETYPE };
	assertEquals(expectedNameTypes.length, nameTypes.length);
	for (Oid expectedNameType : expectedNameTypes) {
		boolean got = false;
		for (Oid nameType : nameTypes) {
			if (nameType.equals(expectedNameType)) {
				got = true;
				break;
			}
		}
		if (!got) {
			fail("Missing expected NameType " + expectedNameType);
		}
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:GSSManagerImplTest.java

示例6: equals

import org.ietf.jgss.Oid; //导入方法依赖的package包/类
public boolean equals(GSSName another) throws GSSException {		
	if (isAnonymous() && another.isAnonymous()) {
		return true;
	}

	if (!(another instanceof KerberosName)) {		
		
		return false;
	}

	KerberosName anotherNameImpl = (KerberosName) another;
	String thisName = getName();
	String anotherName = anotherNameImpl.getName();

	if (!thisName.equals(anotherName)) {
		return false;
	}

	Oid thisOid = getStringNameType();
	Oid anotherOid = anotherNameImpl.getStringNameType();

	if (thisOid.equals(KerberosUtils.KRB5_PRINCIPAL_NAMETYPE)
			|| anotherOid.equals(KerberosUtils.KRB5_PRINCIPAL_NAMETYPE)) {
		return true;
	}
	return thisOid.equals(anotherOid);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:28,代码来源:KerberosName.java

示例7: createName

import org.ietf.jgss.Oid; //导入方法依赖的package包/类
@Override
public GSSName createName(String nameStr, Oid nameType) throws GSSException {
	if(nameType != null && nameType.equals(GSSName.NT_EXPORT_NAME)){
		return GSSNameImpl.importFromString(GSSUtils.getBytes(nameStr), this);
	}		
	return DEFAULT_API.createName(nameStr, nameType);	
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:GSSManagerImpl.java

示例8: encodeGSSAPIAuthenticationPacket

import org.ietf.jgss.Oid; //导入方法依赖的package包/类
/**
 * Encodes the authentication packet for supported authentication methods.
 * 
 * @param request the socks proxy request data
 * @return the encoded buffer
 * @throws GSSException when something fails while using GSSAPI
 */
private IoBuffer encodeGSSAPIAuthenticationPacket(final SocksProxyRequest request) throws GSSException {
    GSSContext ctx = (GSSContext) getSession().getAttribute(GSS_CONTEXT);
    if (ctx == null) {
        // first step in the authentication process
        GSSManager manager = GSSManager.getInstance();
        GSSName serverName = manager.createName(request.getServiceKerberosName(), null);
        Oid krb5OID = new Oid(SocksProxyConstants.KERBEROS_V5_OID);

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Available mechs:");
            for (Oid o : manager.getMechs()) {
                if (o.equals(krb5OID)) {
                    LOGGER.debug("Found Kerberos V OID available");
                }
                LOGGER.debug("{} with oid = {}", manager.getNamesForMech(o), o);
            }
        }

        ctx = manager.createContext(serverName, krb5OID, null, GSSContext.DEFAULT_LIFETIME);

        ctx.requestMutualAuth(true); // Mutual authentication
        ctx.requestConf(false);
        ctx.requestInteg(false);

        getSession().setAttribute(GSS_CONTEXT, ctx);
    }

    byte[] token = (byte[]) getSession().getAttribute(GSS_TOKEN);
    if (token != null) {
        LOGGER.debug("  Received Token[{}] = {}", token.length, ByteUtilities.asHex(token));
    }
    IoBuffer buf = null;

    if (!ctx.isEstablished()) {
        // token is ignored on the first call
        if (token == null) {
            token = new byte[32];
        }

        token = ctx.initSecContext(token, 0, token.length);

        // Send a token to the server if one was generated by
        // initSecContext
        if (token != null) {
            LOGGER.debug("  Sending Token[{}] = {}", token.length, ByteUtilities.asHex(token));

            getSession().setAttribute(GSS_TOKEN, token);
            buf = IoBuffer.allocate(4 + token.length);
            buf.put(new byte[] { SocksProxyConstants.GSSAPI_AUTH_SUBNEGOTIATION_VERSION,
                    SocksProxyConstants.GSSAPI_MSG_TYPE });

            buf.put(ByteUtilities.intToNetworkByteOrder(token.length, 2));
            buf.put(token);
        }
    }

    return buf;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:66,代码来源:Socks5LogicHandler.java

示例9: main

import org.ietf.jgss.Oid; //导入方法依赖的package包/类
public static void main(String[] args)
        throws Exception {

    Oid oldOid = new Oid("1.3.6.1.5.6.2");
    new OneKDC(null).writeJAASConf();

    System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
    GSSManager m = GSSManager.getInstance();
    boolean found = false;

    // Test 1: the getMechsForName() method accepts it.
    for (Oid tmp: m.getMechsForName(oldOid)) {
        if (tmp.equals(GSSUtil.GSS_KRB5_MECH_OID)) {
            found = true;
            break;
        }
    }
    if (!found) {
        throw new Exception("Cannot found krb5 mech for old name type");
    }

    // Test 2: the createName() method accepts it.
    GSSName name = m.createName("[email protected]", oldOid);

    // Test 3: its getStringNameType() output is correct
    if (!name.getStringNameType().equals(GSSName.NT_HOSTBASED_SERVICE)) {
        throw new Exception("GSSName not correct name type");
    }

    // Test 4: everything still works.
    GSSContext c1 = m.createContext(
            name,
            GSSUtil.GSS_KRB5_MECH_OID,
            null,
            GSSContext.DEFAULT_LIFETIME);
    byte[] token = c1.initSecContext(new byte[0], 0, 0);

    Context s;
    s = Context.fromJAAS("server");
    s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
    s.x().acceptSecContext(token, 0, token.length);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:43,代码来源:Test5653.java


注:本文中的org.ietf.jgss.Oid.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。