/** {@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); } }
/** * Create named identifier. * @param principalName Name of the subject. * @param format Format of the subject, whether it is an email, uid etc ... * @return The NamedIdentifier object. * @throws org.apache.rahas.TrustException If unable to find the builder. */ public static NameIdentifier createNamedIdentifier(String principalName, String format) throws TrustException{ NameIdentifier nameId = (NameIdentifier)CommonUtil.buildXMLObject(NameIdentifier.DEFAULT_ELEMENT_NAME); nameId.setNameIdentifier(principalName); nameId.setFormat(format); 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"); }
/** * 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; }
nameIdentifier.setFormat(subjectBean.getSubjectNameIDFormat()); String confirmationMethodStr = subjectBean.getSubjectConfirmationMethod();
nameIdentifier.setFormat(subjectBean.getSubjectNameIDFormat()); String confirmationMethodStr = subjectBean.getSubjectConfirmationMethod();