XmlUtils.xmlAppendEndTag(ServletUtil.XMLTAG_IDENTITY, out);
// Add any returned groups that the user may belong to.
if (response.getGroups() != null) {
for (Object item : response.getGroups()) {
Principal group = (item instanceof String) ?
new Principal((String) item) : (Principal) item;
out.append(ServletUtil.indentStr(3));
out.append('<').append(ServletUtil.XMLTAG_GROUP);
if (group.getPrincipalType() ==
SpiConstants.PrincipalType.UNQUALIFIED) {
// UNQUALIFIED is a special-case on the GSA to allow us to
// prevent the GSA from mistakeningly finding a domain in the
// principal name.
XmlUtils.xmlAppendAttr(
ServletUtil.XMLTAG_PRINCIPALTYPE_ATTRIBUTE,
SpiConstants.PrincipalType.UNQUALIFIED.toString(), out);
}
if (!Strings.isNullOrEmpty(group.getNamespace())) {
XmlUtils.xmlAppendAttr(ServletUtil.XMLTAG_NAMESPACE_ATTRIBUTE,
group.getNamespace(), out);
}
out.append('>');
XmlUtils.xmlAppendAttrValue(group.getName(), out);
XmlUtils.xmlAppendEndTag(ServletUtil.XMLTAG_GROUP, out);
}
}
ServletUtil.writeXMLTag(out, 2, ServletUtil.XMLTAG_SUCCESS, true);
} else {