/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { AttributeConsumingService service = (AttributeConsumingService) samlObject; if (attribute.getLocalName().equals(AttributeConsumingService.INDEX_ATTRIB_NAME)) { service.setIndex(Integer.valueOf(attribute.getValue())); } else if (attribute.getLocalName().equals(AttributeConsumingService.IS_DEFAULT_ATTRIB_NAME)) { service.setIsDefault(XSBooleanValue.valueOf(attribute.getValue())); } else { super.processAttribute(samlObject, attribute); } } }
protected AttributeConsumingService getAttributeConsumingService(List<Attribute> attributes) { AttributeConsumingService service = buildSAMLObject(AttributeConsumingService.class); service.setIsDefault(true); service.setIndex(0); List<RequestedAttribute> attrs = new LinkedList<>(); for (Attribute a : attributes) { RequestedAttribute ra = buildSAMLObject(RequestedAttribute.class); ra.setIsRequired(a.isRequired()); ra.setFriendlyName(a.getFriendlyName()); ra.setName(a.getName()); ra.setNameFormat(a.getNameFormat().toString()); attrs.add(ra); } service.getRequestAttributes().addAll(attrs); return service; }