private Oid nameType;
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;