/** {@inheritDoc} */ @Override public Long convert(final String source) { if (source.startsWith("P")) { return DOMTypeSupport.durationToLong(source.trim()); } else if (source.startsWith("-P")) { throw new IllegalArgumentException("Negative durations are not supported"); } else { // Treat as a milliseconds. But note this final long duration = Long.valueOf(source); log.info("Deprecated duration of {} was specified. Use XML duration of {}", source, DOMTypeSupport.longToDuration(duration)); return duration; } }
/** {@inheritDoc} */ @Override @Nullable public XMLObject filter(@Nullable final XMLObject metadata) throws FilterException { if (metadata == null) { return null; } final DateTime validUntil = getValidUntil(metadata); if (validUntil == null) { throw new FilterException("Metadata did not include a validUntil attribute"); } final DateTime now = new DateTime(ISOChronology.getInstanceUTC()); if (maxValidityInterval > 0 && validUntil.isAfter(now)) { final long validityInterval = validUntil.getMillis() - now.getMillis(); if (validityInterval > maxValidityInterval) { throw new FilterException(String.format("Metadata's validity interval %s is larger than is allowed %s", DOMTypeSupport.longToDuration(validityInterval), DOMTypeSupport.longToDuration(maxValidityInterval))); } } return metadata; }
String cacheDuration = DOMTypeSupport.longToDuration(roleDescriptor.getCacheDuration()); domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
String cacheDuration = DOMTypeSupport.longToDuration(entitiesDescriptor.getCacheDuration()); domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
String cacheDuration = DOMTypeSupport.longToDuration(descriptor.getCacheDuration()); domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
String cacheDuration = DOMTypeSupport.longToDuration(entityDescriptor.getCacheDuration()); domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);