本文整理汇总了Java中org.ietf.jgss.GSSName.NT_HOSTBASED_SERVICE属性的典型用法代码示例。如果您正苦于以下问题:Java GSSName.NT_HOSTBASED_SERVICE属性的具体用法?Java GSSName.NT_HOSTBASED_SERVICE怎么用?Java GSSName.NT_HOSTBASED_SERVICE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.ietf.jgss.GSSName
的用法示例。
在下文中一共展示了GSSName.NT_HOSTBASED_SERVICE属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOidForType
private Oid getOidForType(
String type ) {
if ("NT_USER_NAME".equals(type)) {
return GSSName.NT_USER_NAME;
} else if ("NT_HOSTBASED_SERVICE".equals(type)) {
return GSSName.NT_HOSTBASED_SERVICE;
} else if ("NT_MACHINE_UID_NAME".equals(type)) {
return GSSName.NT_MACHINE_UID_NAME;
} else if ("NT_STRING_UID_NAME".equals(type)) {
return GSSName.NT_STRING_UID_NAME;
} else if ("NT_ANONYMOUS".equals(type)) {
return GSSName.NT_ANONYMOUS;
} else if ("NT_EXPORT_NAME".equals(type)) {
return GSSName.NT_EXPORT_NAME;
}
return GSSName.NT_USER_NAME;
}
示例2: testGetNamesForMech
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);
}
}
}
示例3: testGetMechsForName
public void testGetMechsForName() throws Exception {
Oid nameType = GSSName.NT_ANONYMOUS;
Oid[] mechs = gssManager.getMechsForName(nameType);
assertEquals(0, mechs.length);
nameType = GSSName.NT_MACHINE_UID_NAME;
mechs = gssManager.getMechsForName(nameType);
assertEquals(0, mechs.length);
nameType = GSSName.NT_STRING_UID_NAME;
mechs = gssManager.getMechsForName(nameType);
assertEquals(0, mechs.length);
nameType = GSSName.NT_USER_NAME;
mechs = gssManager.getMechsForName(nameType);
Oid kerberosMech = new Oid("1.2.840.113554.1.2.2");
Oid[] expectedMechs = new Oid[] { kerberosMech };
assertTrue(Arrays.equals(expectedMechs, mechs));
nameType = GSSName.NT_HOSTBASED_SERVICE;
mechs = gssManager.getMechsForName(nameType);
assertTrue(Arrays.equals(expectedMechs, mechs));
nameType = GSSName.NT_EXPORT_NAME;
mechs = gssManager.getMechsForName(nameType);
assertTrue(Arrays.equals(expectedMechs, mechs));
nameType = KerberosUtils.KRB5_PRINCIPAL_NAMETYPE;
mechs = gssManager.getMechsForName(nameType);
assertTrue(Arrays.equals(expectedMechs, mechs));
}
示例4: testHostbasedService2
public void testHostbasedService2() throws Exception {
GSSName n1 = new GlobusGSSName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
GSSName n2 = new GlobusGSSName("/C=US/O=Globus/CN=globuscvs.mcs.anl-external.org", null);
assertEquals("/CN=host/globuscvs.mcs.anl-external.org", n1.toString());
assertTrue(n1.equals(n2));
GSSName m1 = new GlobusGSSName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
GSSName m2 = new GlobusGSSName("/C=US/O=Globus/CN=dc-user2.isi.edu", null);
assertEquals("/CN=host/dc-user2.isi.edu", m1.toString());
assertTrue(m1.equals(m2));
}
示例5: testEquals2
public void testEquals2() throws Exception {
GSSName n1 = new GlobusGSSName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
GSSName n2 = new GlobusGSSName("/C=US/O=Globus/CN=pitcairn.mcs.anl.gov", null);
GSSName n3 = new GlobusGSSName("/C=US/O=Globus/CN=host/pitcairn.MCS.anl.gov", null);
GSSName n4 = new GlobusGSSName("/C=US/O=Globus/CN=ftp/pitcairn.mcs.anl.gOv", null);
GSSName n5 = new GlobusGSSName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
GSSName n6 = new GlobusGSSName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
GSSName n7 = new GlobusGSSName("/C=US/O=Globus/CN=pitcairn-9.mcs.anl.gov", null);
assertTrue(n1.equals(n1));
assertTrue(n2.equals(n2));
assertTrue(n1.equals(n2));
assertTrue(n2.equals(n1));
assertTrue(n1.equals(n3));
assertTrue(n3.equals(n1));
assertTrue(!n4.equals(n1));
assertTrue(n5.equals(n4));
assertTrue(n4.equals(n5));
assertTrue(!n1.equals(n5));
assertTrue(n1.equals(n6));
assertTrue(n7.equals(n6));
assertTrue(!n2.equals(n3));
assertTrue(!n3.equals(n4));
assertTrue(!n4.equals(n7));
}
示例6: testExport
public void testExport() throws Exception {
KerberosName kerberosName = new KerberosName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
byte[] exported = kerberosName.export();
byte[] expected = new byte[] { 4,1,0,11,6,9,42,-122,72,-122,-9,18,1,2,2,0,0,0,17,115,101,114,118,105,99,101,47,108,111,99,97,108,104,111,115,116 };
assertTrue(Arrays.equals(expected, exported));
}
示例7: testEquals
public void testEquals() throws Exception{
KerberosName one = new KerberosName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
KerberosName another = new KerberosName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
assertEquals(one, another);
one = new KerberosName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
another = new KerberosName("service/localhost", GSSName.NT_HOSTBASED_SERVICE);
assertEquals(one, another);
one = new KerberosName("[email protected]", GSSName.NT_USER_NAME);
another = new KerberosName("[email protected]", GSSName.NT_USER_NAME);
assertEquals(one, another);
one = new KerberosName("[email protected]", GSSName.NT_USER_NAME);
another = new KerberosName("service/localhost", GSSName.NT_USER_NAME);
assertFalse(one.equals(another));
final Oid KRB5_PRINCIPAL_NAMETYPE = new Oid("1.2.840.113554.1.2.2.1");
one = new KerberosName("[email protected]", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("[email protected]", KRB5_PRINCIPAL_NAMETYPE);
assertEquals(one, another);
one = new KerberosName("[email protected]", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("service/localhost",KRB5_PRINCIPAL_NAMETYPE);
assertFalse(one.equals(another));
one = new KerberosName("[email protected]", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("[email protected]", GSSName.NT_USER_NAME);
assertEquals(one,another);
one = new KerberosName("[email protected]", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
assertFalse(one.equals(another));
one = new KerberosName("service/localhost", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
assertEquals(one,another);
one = new KerberosName("[email protected]", GSSName.NT_USER_NAME);
another = new KerberosName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
assertFalse(one.equals(another));
one = new KerberosName("service/localhost", GSSName.NT_USER_NAME);
another = new KerberosName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
assertFalse(one.equals(another));
}
示例8: testHostbasedService3
public void testHostbasedService3() throws Exception {
GSSName n1 = new GlobusGSSName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
GSSName n2 = new GlobusGSSName("/C=US/O=Globus/CN=host/pitcairn.mcs.anl.gov/CN=12345678", null);
assertTrue(n1.equals(n2));
}
示例9: testConversion
public void testConversion() throws Exception {
GSSName n1 = new GlobusGSSName("[email protected]", GSSName.NT_HOSTBASED_SERVICE);
assertEquals("/CN=ftp/pitcairn.mcs.anl.gov", n1.toString());
GSSName n2 = new GlobusGSSName("/C=US/O=Globus/O=ANL/CN=gawor", null);
assertEquals("/C=US/O=Globus/O=ANL/CN=gawor", n2.toString());
}