/** * Gets the validUntil time of the metadata, if present. * * @param metadata metadata from which to get the validUntil instant * * @return the valid until instant or null if it is not present * * @throws FilterException thrown if the given XML object is not an {@link EntitiesDescriptor} or * {@link EntityDescriptor} */ @Nullable protected DateTime getValidUntil(@Nonnull final XMLObject metadata) throws FilterException { if (metadata instanceof EntitiesDescriptor) { return ((EntitiesDescriptor) metadata).getValidUntil(); } else if (metadata instanceof EntityDescriptor) { return ((EntityDescriptor) metadata).getValidUntil(); } else { log.error("Metadata root element was not an EntitiesDescriptor or EntityDescriptor it was a {}", metadata .getElementQName()); throw new FilterException("Metadata root element was not an EntitiesDescriptor or EntityDescriptor"); } }
if (entitiesDescriptor.getValidUntil() != null) { log.debug("Writting validUntil attribute to EntitiesDescriptor DOM element"); String validUntilStr = SAMLConfigurationSupport.getSAMLDateFormatter().print(entitiesDescriptor.getValidUntil()); domElement.setAttributeNS(null, TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME, validUntilStr);