本文整理汇总了Java中org.ietf.jgss.GSSName.isAnonymous方法的典型用法代码示例。如果您正苦于以下问题:Java GSSName.isAnonymous方法的具体用法?Java GSSName.isAnonymous怎么用?Java GSSName.isAnonymous使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ietf.jgss.GSSName
的用法示例。
在下文中一共展示了GSSName.isAnonymous方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.ietf.jgss.GSSName; //导入方法依赖的package包/类
public static void main(String[] argv) throws Exception {
try {
GSSManager manager = GSSManager.getInstance();
GSSName name = manager.createName("anonymous", GSSName.NT_ANONYMOUS);
boolean anonymous = name.isAnonymous();
if (anonymous == false) {
throw new RuntimeException("GSSName.isAnonymous() returns false for GSSName.NT_ANONYMOUS");
}
} catch (GSSException e) {
System.out.println("Not supported, ignored!");
}
}
示例2: equals
import org.ietf.jgss.GSSName; //导入方法依赖的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);
}
示例3: toGlobusPrincipal
import org.ietf.jgss.GSSName; //导入方法依赖的package包/类
/**
* Converts the specified GSSName to GlobusPrincipal.
* The GSSName is converted into the GlobusPrincipal
* only if the GSSName is of type
* <code>org.globus.gsi.gssapi.GlobusGSSName</code>
* and the name is not anonymous.
*/
public static GlobusPrincipal toGlobusPrincipal(GSSName name) {
return (!name.isAnonymous() &&
(name instanceof GlobusGSSName)) ?
new GlobusPrincipal(name.toString()) :
null;
}