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()); } } }
set.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME)); val entitySp = chainingMetadataResolver.resolveSingle(set); if (entitySp != null && entitySp.getCacheDuration() != null) { LOGGER.debug("Located cache duration [{}] specified in SP metadata for [{}]", entitySp.getCacheDuration(), entitySp.getEntityID()); return TimeUnit.MILLISECONDS.toNanos(entitySp.getCacheDuration()); set.add(new EntityIdCriterion(service.getServiceId())); val entity = chainingMetadataResolver.resolveSingle(set); if (entity != null && entity.getCacheDuration() != null) { LOGGER.debug("Located cache duration [{}] specified in entity metadata for [{}]", entity.getCacheDuration(), entity.getEntityID()); return TimeUnit.MILLISECONDS.toNanos(entity.getCacheDuration());
if (entityDescriptor.getCacheDuration() != null) { log.debug("Writting cacheDuration attribute to EntityDescriptor DOM element"); String cacheDuration = DOMTypeSupport.longToDuration(entityDescriptor.getCacheDuration()); domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
protected Metadata resolveMetadata(EntityDescriptor parsed) { EntityDescriptor descriptor = parsed; List<? extends Provider> ssoProviders = getSsoProviders(descriptor); Metadata desc = getMetadata(ssoProviders); long duration = descriptor.getCacheDuration() != null ? descriptor.getCacheDuration() : -1; desc.setCacheDuration(toDuration(duration)); desc.setEntityId(descriptor.getEntityID()); desc.setEntityAlias(descriptor.getEntityID()); desc.setId(descriptor.getID()); desc.setValidUntil(descriptor.getValidUntil()); return desc; }