/** {@inheritDoc} */ protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException { NameIdentifier nameIdentifier = (NameIdentifier) samlElement; if (nameIdentifier.getNameQualifier() != null) { domElement .setAttributeNS(null, NameIdentifier.NAMEQUALIFIER_ATTRIB_NAME, nameIdentifier.getNameQualifier()); } if (nameIdentifier.getFormat() != null) { domElement.setAttributeNS(null, NameIdentifier.FORMAT_ATTRIB_NAME, nameIdentifier.getFormat()); } }
/** * Gets the format of the name identifier used to identify the subject. * * @param nameIdentifier name identifier used to identify the subject * * @return format of the name identifier used to identify the subject */ protected String getNameIdentifierFormat(SAMLObject nameIdentifier) { String subjectNameFormat = null; if (nameIdentifier instanceof NameIdentifier) { NameIdentifier identifier = (NameIdentifier) nameIdentifier; subjectNameFormat = identifier.getFormat(); } else if (nameIdentifier instanceof NameID) { NameID identifier = (NameID) nameIdentifier; subjectNameFormat = identifier.getFormat(); } if (DatatypeHelper.isEmpty(subjectNameFormat)) { subjectNameFormat = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"; } return subjectNameFormat; }