/** {@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); } } }
private void validateMetadata(EntityDescriptor root) { if (root.getCacheDuration() == null && root.getValidUntil() == null) { LOGGER.trace( "IDP metadata must either have cache duration or valid-until date." + " Defaulting IDP metadata cache duration to {}", SamlProtocol.getCacheDuration()); root.setCacheDuration(SamlProtocol.getCacheDuration().toMillis()); } } }
entityDescriptor.setCacheDuration(getCacheDuration().toMillis());
entityDescriptor.setCacheDuration(getCacheDuration().toMillis());