/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { Attribute attrib = (Attribute) samlObject; if (attribute.getLocalName().equals(Attribute.NAME_ATTTRIB_NAME)) { attrib.setName(attribute.getValue()); } else if (attribute.getLocalName().equals(Attribute.NAME_FORMAT_ATTRIB_NAME)) { attrib.setNameFormat(attribute.getValue()); } else if (attribute.getLocalName().equals(Attribute.FRIENDLY_NAME_ATTRIB_NAME)) { attrib.setFriendlyName(attribute.getValue()); } else { QName attribQName = XMLHelper.getNodeQName(attribute); if (attribute.isId()) { attrib.getUnknownAttributes().registerID(attribQName); } attrib.getUnknownAttributes().put(attribQName, attribute.getValue()); } } }
/** QName for the attribute resource */ public static Attribute createAttribute(String name, String friendlyName,String nameFormat) { Attribute attribute = new AttributeBuilder().buildObject(); attribute.setName(name); attribute.setFriendlyName(friendlyName); attribute.setNameFormat(nameFormat); return attribute; }
/** * Populates the attribute with attribute name, name format, and friendly name information. * * @param attribute to populate */ protected void populateAttribute(Attribute attribute) { attribute.setName(getAttributeName()); attribute.setNameFormat(getNameFormat()); attribute.setFriendlyName(getFriendlyName()); } }
/** {@inheritDoc} */ public Attribute encode(BaseAttribute attribute) throws AttributeEncodingException { Attribute samlAttribute = attributeBuilder.buildObject(); samlAttribute.setName(getAttributeName()); samlAttribute.setNameFormat(getNameFormat()); samlAttribute.setFriendlyName(getFriendlyName()); samlAttribute.getAttributeValues() .addAll(encodeAttributeValues(AttributeValue.DEFAULT_ELEMENT_NAME, attribute)); List<XMLObject> attributeValues = samlAttribute.getAttributeValues(); if (attributeValues == null || attributeValues.isEmpty()) { log.debug("Unable to encode {} attribute. It does not contain any values", attribute.getId()); return null; } return samlAttribute; } }
/** * Create an Attribute object. * * @param friendlyName of type String * @param name of type String * @param nameFormat of type String * @return an Attribute object */ @SuppressWarnings("unchecked") public static Attribute createAttribute(String friendlyName, String name, String nameFormat) { if (attributeBuilder == null) { attributeBuilder = (SAMLObjectBuilder<Attribute>) builderFactory.getBuilder(Attribute.DEFAULT_ELEMENT_NAME); } Attribute attribute = attributeBuilder.buildObject(); attribute.setFriendlyName(friendlyName); if (nameFormat == null) { attribute.setNameFormat(SAML2Constants.ATTRNAME_FORMAT_URI); } else { attribute.setNameFormat(nameFormat); } attribute.setName(name); return attribute; }
/** * Create an Attribute object. * * @param friendlyName of type String * @param name of type String * @param nameFormat of type String * @return an Attribute object */ @SuppressWarnings("unchecked") public static Attribute createAttribute(String friendlyName, String name, String nameFormat) { if (attributeBuilder == null) { attributeBuilder = (SAMLObjectBuilder<Attribute>) builderFactory.getBuilder(Attribute.DEFAULT_ELEMENT_NAME); } Attribute attribute = attributeBuilder.buildObject(); attribute.setFriendlyName(friendlyName); if (nameFormat == null) { attribute.setNameFormat(SAML2Constants.ATTRNAME_FORMAT_URI); } else { attribute.setNameFormat(nameFormat); } attribute.setName(name); return attribute; }
/** * Create an Attribute model. * * @param friendlyName of type String * @param name of type String * @param nameFormat of type String * @return an Attribute model */ @SuppressWarnings("unchecked") public static Attribute createAttribute(String friendlyName, String name, String nameFormat) { if (attributeBuilder == null) { attributeBuilder = (SAMLObjectBuilder<Attribute>) builderFactory.getBuilder(Attribute.DEFAULT_ELEMENT_NAME); } Attribute attribute = attributeBuilder.buildObject(); attribute.setFriendlyName(friendlyName); if (nameFormat == null) { attribute.setNameFormat(SamlConstants.ATTRNAME_FORMAT_URI); } else { attribute.setNameFormat(nameFormat); } attribute.setName(name); return attribute; } /**