/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { EntityDescriptor entityDescriptor = (EntityDescriptor) samlObject; if (attribute.getLocalName().equals(EntityDescriptor.ENTITY_ID_ATTRIB_NAME)) { entityDescriptor.setEntityID(attribute.getValue()); } else if (attribute.getLocalName().equals(EntityDescriptor.ID_ATTRIB_NAME)) { entityDescriptor.setID(attribute.getValue()); attribute.getOwnerElement().setIdAttributeNode(attribute, true); } else if (attribute.getLocalName().equals(TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME) && !Strings.isNullOrEmpty(attribute.getValue())) { entityDescriptor.setValidUntil(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC())); } else if (attribute.getLocalName().equals(CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME)) { entityDescriptor.setCacheDuration(DOMTypeSupport.durationToLong(attribute.getValue())); } else { processUnknownAttribute(entityDescriptor, attribute); } } }
@Override public final EntityDescriptor buildEntityDescriptor() { final SAMLObjectBuilder<EntityDescriptor> builder = (SAMLObjectBuilder<EntityDescriptor>) this.builderFactory.getBuilder(EntityDescriptor.DEFAULT_ELEMENT_NAME); final EntityDescriptor descriptor = builder.buildObject(); descriptor.setEntityID(this.entityId); descriptor.setValidUntil(DateTime.now(DateTimeZone.UTC).plusYears(20)); descriptor.setID(SAML2Utils.generateID()); descriptor.setExtensions(generateMetadataExtensions()); descriptor.getRoleDescriptors().add(buildSPSSODescriptor()); return descriptor; }