/** * Reconstruct the PrincipalName String from teh stored components */ private String makeSingleName() { List<String> names = getNameStrings(); StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (String name : names) { if (isFirst) { isFirst = false; } else { sb.append('/'); } sb.append(name); } if (realm != null && !realm.isEmpty()) { sb.append('@'); sb.append(realm); } return sb.toString(); }
/** * Reconstruct the PrincipalName String from teh stored components */ private String makeSingleName() { List<String> names = getNameStrings(); StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (String name : names) { if (isFirst) { isFirst = false; } else { sb.append('/'); } sb.append(name); } if (realm != null && !realm.isEmpty()) { sb.append('@'); sb.append(realm); } return sb.toString(); }
/** * Create a SALT based on the PrincipalName, accordingly to RFC 4120 : * "The default salt string, if none is provided via pre-authentication * data, is the concatenation of the principal's realm and name components, * in order, with no separators." * * @param principalName The PrincipalName for which we want to create a salt * @return The created salt */ public static String makeSalt(PrincipalName principalName) { StringBuilder salt = new StringBuilder(); if (principalName.getRealm() != null) { salt.append(principalName.getRealm()); } List<String> nameStrings = principalName.getNameStrings(); for (String ns : nameStrings) { salt.append(ns); } return salt.toString(); }
/** * Create a SALT based on the PrincipalName, accordingly to RFC 4120 : * "The default salt string, if none is provided via pre-authentication * data, is the concatenation of the principal's realm and name components, * in order, with no separators." * * @param principalName The PrincipalName for which we want to create a salt * @return The created salt */ public static String makeSalt(PrincipalName principalName) { StringBuilder salt = new StringBuilder(); if (principalName.getRealm() != null) { salt.append(principalName.getRealm()); } List<String> nameStrings = principalName.getNameStrings(); for (String ns : nameStrings) { salt.append(ns); } return salt.toString(); }
public void writePrincipal(PrincipalName principal, int version) throws IOException { List<String> nameStrings = principal.getNameStrings(); int numComponents = principal.getNameStrings().size(); String realm = principal.getRealm(); writeShort(numComponents); writeCountedString(realm); for (String nameCom : nameStrings) { writeCountedString(nameCom); } writeInt(principal.getNameType().getValue()); // todo: consider the version }
public void writePrincipal(PrincipalName principal, int version) throws IOException { List<String> nameStrings = principal.getNameStrings(); int numComponents = principal.getNameStrings().size(); String realm = principal.getRealm(); writeShort(numComponents); writeCountedString(realm); for (String nameCom : nameStrings) { writeCountedString(nameCom); } writeInt(principal.getNameType().getValue()); // todo: consider the version }
@Override public void writePrincipal(PrincipalName principal, int version) throws IOException { List<String> nameComponents = principal.getNameStrings(); if (version != CredentialCache.FCC_FVNO_1) { writeInt(principal.getNameType().getValue()); } int numComponents = nameComponents.size(); if (version == CredentialCache.FCC_FVNO_1) { numComponents++; } writeInt(numComponents); writeRealm(principal.getRealm()); for (String nameCom : nameComponents) { writeCountedString(nameCom); } }
@Override public void writePrincipal(PrincipalName principal, int version) throws IOException { List<String> nameComponents = principal.getNameStrings(); if (version != CredentialCache.FCC_FVNO_1) { writeInt(principal.getNameType().getValue()); } int numComponents = nameComponents.size(); if (version == CredentialCache.FCC_FVNO_1) { numComponents++; } writeInt(numComponents); writeRealm(principal.getRealm()); for (String nameCom : nameComponents) { writeCountedString(nameCom); } }