/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { NameIdentifier nameIdentifier = (NameIdentifier) samlObject; if (NameIdentifier.FORMAT_ATTRIB_NAME.equals(attribute.getLocalName())) { nameIdentifier.setFormat(attribute.getValue()); } else if (NameIdentifier.NAMEQUALIFIER_ATTRIB_NAME.equals(attribute.getLocalName())) { nameIdentifier.setNameQualifier(attribute.getValue()); } else { super.processAttribute(samlObject, attribute); } }
/** * Builds a name ID. The provided value is the textual content of the NameIdentifier. If a {@link #nameIdQualifier} * is not null it is used as the NameIdentifier's name qualifier, otherwise the attribute issuer's entity id is * used. * * @param nameIdValue value of the NameIdentifier * @param resolutionContext current resolution context * * @return the constructed NameIdentifier */ protected NameIdentifier buildNameId(String nameIdValue, ShibbolethResolutionContext resolutionContext) { NameIdentifier nameId = nameIdBuilder.buildObject(); nameId.setNameIdentifier(nameIdValue); if (nameIdFormat != null) { nameId.setFormat(nameIdFormat); } if (nameIdQualifier != null) { nameId.setNameQualifier(nameIdQualifier); } else { nameId.setNameQualifier(resolutionContext.getAttributeRequestContext().getLocalEntityId()); } return nameId; }
/** {@inheritDoc} */ public NameIdentifier encode(BaseAttribute attribute) throws AttributeEncodingException { if (attribute.getValues() != null) { for (final Object value : attribute.getValues()) { // Check for null, empty, or solely whitespace. But don't trim the value encoded. final String valueStr = value.toString(); if (DatatypeHelper.safeTrimOrNullString(valueStr) != null) { NameIdentifier nameId = identifierBuilder.buildObject(); nameId.setNameIdentifier(valueStr); if (nameFormat != null) { nameId.setFormat(nameFormat); } if (nameQualifier != null) { nameId.setNameQualifier(nameQualifier); } return nameId; } } } throw new AttributeEncodingException(attribute.getId() + " attribute does not contain any non-empty values to encode"); }
ConfirmationMethod confirmationMethod = confirmationMethodV1Builder.buildObject(); nameIdentifier.setNameQualifier(subjectBean.getSubjectNameQualifier()); nameIdentifier.setNameIdentifier(subjectBean.getSubjectName()); nameIdentifier.setFormat(subjectBean.getSubjectNameIDFormat());
ConfirmationMethod confirmationMethod = confirmationMethodV1Builder.buildObject(); nameIdentifier.setNameQualifier(subjectBean.getSubjectNameQualifier()); nameIdentifier.setNameIdentifier(subjectBean.getSubjectName()); nameIdentifier.setFormat(subjectBean.getSubjectNameIDFormat());