[java-opensaml] branch master updated: JSPT-79 - Review date and time handling for Java 8

Scott Cantor cantor.2 at osu.edu
Thu Mar 14 16:35:05 EDT 2019


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=a6787aabd0d39c737ba85fe78e67c44095ec3601

The following commit(s) were added to refs/heads/master by this push:
       new  a6787aa   JSPT-79 - Review date and time handling for Java 8
a6787aa is described below

commit a6787aabd0d39c737ba85fe78e67c44095ec3601
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Mar 14 16:35:03 2019 -0400

    JSPT-79 - Review date and time handling for Java 8
    
    https://issues.shibboleth.net/jira/browse/JSPT-79
    
    Convert CacheableSAMLObject interface to Duration.
---
 .../saml/saml2/common/CacheableSAMLObject.java     | 22 +++++++--------
 .../opensaml/saml/saml2/common/SAML2Support.java   |  4 +--
 .../saml/saml2/common/TimeBoundSAMLObject.java     | 18 ++++++-------
 .../metadata/impl/AffiliationDescriptorImpl.java   | 31 +++++++---------------
 .../impl/AffiliationDescriptorMarshaller.java      | 11 ++++----
 .../impl/AffiliationDescriptorUnmarshaller.java    |  2 +-
 .../metadata/impl/EntitiesDescriptorImpl.java      |  7 ++---
 .../impl/EntitiesDescriptorMarshaller.java         | 14 +++++-----
 .../impl/EntitiesDescriptorUnmarshaller.java       |  2 +-
 .../saml2/metadata/impl/EntityDescriptorImpl.java  |  7 ++---
 .../metadata/impl/EntityDescriptorMarshaller.java  |  6 ++---
 .../impl/EntityDescriptorUnmarshaller.java         |  2 +-
 .../saml2/metadata/impl/RoleDescriptorImpl.java    | 30 +++------------------
 .../metadata/impl/RoleDescriptorMarshaller.java    |  6 ++---
 .../metadata/impl/RoleDescriptorUnmarshaller.java  |  2 +-
 .../metadata/impl/AffiliationDescriptorTest.java   | 11 ++++----
 .../impl/AuthnAuthorityDescriptorTest.java         |  9 ++++---
 .../metadata/impl/EntitiesDescriptorTest.java      | 11 ++++----
 .../saml2/metadata/impl/EntityDescriptorTest.java  |  9 ++++---
 .../saml2/metadata/impl/IDPSSODescriptorTest.java  |  7 ++---
 .../saml2/metadata/impl/PDPDescriptorTest.java     |  7 ++---
 .../saml2/metadata/impl/SPSSODescriptorTest.java   |  5 ++--
 .../AffiliationDescriptorOptionalAttributes.xml    |  2 +-
 .../AuthnAuthorityDescriptorOptionalAttributes.xml |  2 +-
 .../impl/EntitiesDescriptorOptionalAttributes.xml  |  2 +-
 .../impl/EntityDescriptorOptionalAttributes.xml    |  2 +-
 .../impl/IDPSSODescriptorOptionalAttributes.xml    |  2 +-
 .../impl/PDPDescriptorOptionalAttributes.xml       |  2 +-
 .../impl/SPSSODescriptorOptionalAttributes.xml     |  2 +-
 29 files changed, 101 insertions(+), 136 deletions(-)

diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/CacheableSAMLObject.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/CacheableSAMLObject.java
index a33bd55..10b0984 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/CacheableSAMLObject.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/CacheableSAMLObject.java
@@ -17,10 +17,14 @@
 
 package org.opensaml.saml.saml2.common;
 
-import javax.xml.namespace.QName;
+import java.time.Duration;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import org.opensaml.saml.common.SAMLObject;
-import org.opensaml.saml.common.xml.SAMLConstants;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 
 /**
  * A functional interface for SAMLElements that provide cache duration information.
@@ -29,24 +33,20 @@ import org.opensaml.saml.common.xml.SAMLConstants;
 public interface CacheableSAMLObject extends SAMLObject{
 
     /** "cacheDuration" attribute name. */
-    public static final String CACHE_DURATION_ATTRIB_NAME = "cacheDuration";
-
-    /** "cacheDuration" attribute's QName. */
-    public static final QName CACHE_DURATION_ATTRIB_QNAME =
-            new QName(SAMLConstants.SAML20MD_NS, CACHE_DURATION_ATTRIB_NAME, SAMLConstants.SAML20MD_PREFIX);
+    @Nonnull @NotEmpty static final String CACHE_DURATION_ATTRIB_NAME = "cacheDuration";
 
     /**
-     * Gets the maximum time, in milliseconds, that this descriptor should be cached.
+     * Gets the maximum time that this descriptor should be cached.
      *  
      * @return the maximum time that this descriptor should be cached
      */
-    public Long getCacheDuration();
+    @Nullable Duration getCacheDuration();
 
     /**
-     * Sets the maximum time, in milliseconds, that this descriptor should be cached.
+     * Sets the maximum time that this descriptor should be cached.
      * 
      * @param duration the maximum time that this descriptor should be cached
      */
-    public void setCacheDuration(Long duration);
+    void setCacheDuration(@Nullable final Duration duration);
 
 }
\ No newline at end of file
diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/SAML2Support.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/SAML2Support.java
index 7e78369..d168873 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/SAML2Support.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/SAML2Support.java
@@ -131,8 +131,8 @@ public final class SAML2Support {
         
         Instant earliestExpiration = candidateTime;
 
-        if (cacheableObject.getCacheDuration() != null && cacheableObject.getCacheDuration() > 0) {
-            final Instant elementExpirationTime = now.plusMillis(cacheableObject.getCacheDuration());
+        if (cacheableObject.getCacheDuration() != null && !cacheableObject.getCacheDuration().isNegative()) {
+            final Instant elementExpirationTime = now.plus(cacheableObject.getCacheDuration());
             if (earliestExpiration == null) {
                 earliestExpiration = elementExpirationTime;
             } else {
diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/TimeBoundSAMLObject.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/TimeBoundSAMLObject.java
index f6155bb..a54b7f6 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/TimeBoundSAMLObject.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/TimeBoundSAMLObject.java
@@ -19,10 +19,12 @@ package org.opensaml.saml.saml2.common;
 
 import java.time.Instant;
 
-import javax.xml.namespace.QName;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import org.opensaml.saml.common.SAMLObject;
-import org.opensaml.saml.common.xml.SAMLConstants;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 
 /**
  * A functional interface for SAMLElements that are bounded with a 
@@ -31,31 +33,27 @@ import org.opensaml.saml.common.xml.SAMLConstants;
 public interface TimeBoundSAMLObject extends SAMLObject{
 
     /** "validUntil" attribute's local name. */
-    public static final String VALID_UNTIL_ATTRIB_NAME = "validUntil";
-
-    /** "validUntil" attribute's QName. */
-    public static final QName VALID_UNTIL_ATTRIB_QNAME =
-            new QName(SAMLConstants.SAML20MD_NS, VALID_UNTIL_ATTRIB_NAME, SAMLConstants.SAML20MD_PREFIX);
+    @Nonnull @NotEmpty static final String VALID_UNTIL_ATTRIB_NAME = "validUntil";
 
     /**
      * Checks to see if the current time is past the validUntil time.
      * 
      * @return true of this descriptor is still valid otherwise false
      */
-    public boolean isValid();
+    boolean isValid();
 
     /**
      * Gets the date until which this descriptor is valid.
      * 
      * @return the date until which this descriptor is valid
      */
-    public Instant getValidUntil();
+    @Nullable Instant getValidUntil();
 
     /**
      * Sets the date until which this descriptor is valid.
      * 
      * @param validUntil the date until which this descriptor is valid
      */
-    public void setValidUntil(Instant validUntil);
+    void setValidUntil(@Nullable final Instant validUntil);
 
 }
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorImpl.java
index 010f70c..d2ec716 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorImpl.java
@@ -21,6 +21,7 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
+import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -50,7 +51,7 @@ public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implem
     private Instant validUntil;
 
     /** cacheDurection attribute. */
-    private Long cacheDuration;
+    private Duration cacheDuration;
 
     /** Extensions child. */
     private Extensions extensions;
@@ -80,13 +81,11 @@ public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implem
     }
 
     /** {@inheritDoc} */
-    @Override
     public String getOwnerID() {
         return ownerID;
     }
 
     /** {@inheritDoc} */
-    @Override
     public void setOwnerID(final String newOwnerID) {
         if (newOwnerID != null && newOwnerID.length() > 1024) {
             throw new IllegalArgumentException("Owner ID can not exceed 1024 characters in length");
@@ -95,21 +94,18 @@ public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implem
     }
     
     /** {@inheritDoc} */
-    @Override
     public String getID() {
         return id;
     }
     
     /** {@inheritDoc} */
-    @Override
     public void setID(final String newID) {
-        final String oldID = this.id;
-        this.id = prepareForAssignment(this.id, newID);
-        registerOwnID(oldID, this.id);
+        final String oldID = id;
+        this.id = prepareForAssignment(id, newID);
+        registerOwnID(oldID, id);
     }
 
     /** {@inheritDoc} */
-    @Override
     public boolean isValid() {
         if (null == validUntil) {
             return true;
@@ -119,55 +115,46 @@ public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implem
     }
 
     /** {@inheritDoc} */
-    @Override
     public Instant getValidUntil() {
         return validUntil;
     }
 
     /** {@inheritDoc} */
-    @Override
     public void setValidUntil(final Instant theValidUntil) {
-        this.validUntil = prepareForAssignment(this.validUntil, theValidUntil);
+        validUntil = prepareForAssignment(validUntil, theValidUntil);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public Long getCacheDuration() {
+    public Duration getCacheDuration() {
         return cacheDuration;
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void setCacheDuration(final Long duration) {
+    public void setCacheDuration(final Duration duration) {
         cacheDuration = prepareForAssignment(cacheDuration, duration);
     }
 
     /** {@inheritDoc} */
-    @Override
     public Extensions getExtensions() {
         return extensions;
     }
 
     /** {@inheritDoc} */
-    @Override
     public void setExtensions(final Extensions theExtensions) {
-        this.extensions = prepareForAssignment(this.extensions, theExtensions);
+        extensions = prepareForAssignment(extensions, theExtensions);
     }
 
     /** {@inheritDoc} */
-    @Override
     public List<AffiliateMember> getMembers() {
         return members;
     }
 
     /** {@inheritDoc} */
-    @Override
     public List<KeyDescriptor> getKeyDescriptors() {
         return keyDescriptors;
     }
     
     /** {@inheritDoc} */
-    @Override
     public AttributeMap getUnknownAttributes() {
         return unknownAttributes;
     }
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorMarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorMarshaller.java
index 369729c..4d012c1 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorMarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorMarshaller.java
@@ -21,8 +21,6 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
-import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
-
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.core.xml.io.MarshallingException;
 import org.opensaml.saml.common.AbstractSAMLObjectMarshaller;
@@ -60,7 +58,7 @@ public class AffiliationDescriptorMarshaller extends AbstractSAMLObjectMarshalle
 
         // Set the validUntil attribute
         if (descriptor.getValidUntil() != null) {
-            log.debug("Writting validUntil attribute to AffiliationDescriptor DOM element");
+            log.trace("Writting validUntil attribute to AffiliationDescriptor DOM element");
             final String validUntilStr =
                     SAMLConfigurationSupport.getSAMLDateFormatter().format(descriptor.getValidUntil());
             domElement.setAttributeNS(null, TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME, validUntilStr);
@@ -68,11 +66,12 @@ public class AffiliationDescriptorMarshaller extends AbstractSAMLObjectMarshalle
 
         // Set the cacheDuration attribute
         if (descriptor.getCacheDuration() != null) {
-            log.debug("Writting cacheDuration attribute to AffiliationDescriptor DOM element");
-            final String cacheDuration = DOMTypeSupport.longToDuration(descriptor.getCacheDuration());
-            domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
+            log.trace("Writting cacheDuration attribute to AffiliationDescriptor DOM element");
+            domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME,
+                    descriptor.getCacheDuration().toString());
         }
 
         marshallUnknownAttributes(descriptor, domElement);
     }
+    
 }
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorUnmarshaller.java
index 137656f..470dbe5 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorUnmarshaller.java
@@ -72,7 +72,7 @@ public class AffiliationDescriptorUnmarshaller extends AbstractSAMLObjectUnmarsh
                     && !Strings.isNullOrEmpty(attribute.getValue())) {
                 descriptor.setValidUntil(Instant.parse(attribute.getValue()));
             } else if (attribute.getLocalName().equals(CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME)) {
-                descriptor.setCacheDuration(DOMTypeSupport.durationToLong(attribute.getValue()));
+                descriptor.setCacheDuration(DOMTypeSupport.durationToDuration(attribute.getValue()));
             } else {
                 super.processAttribute(samlObject, attribute);
             }
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorImpl.java
index 968c73b..8c34782 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorImpl.java
@@ -17,6 +17,7 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
+import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -45,7 +46,7 @@ public class EntitiesDescriptorImpl extends AbstractSignableSAMLObject implement
     private Instant validUntil;
 
     /** cacheDurection attribute. */
-    private Long cacheDuration;
+    private Duration cacheDuration;
 
     /** Extensions child. */
     private Extensions extensions;
@@ -108,12 +109,12 @@ public class EntitiesDescriptorImpl extends AbstractSignableSAMLObject implement
     }
 
     /** {@inheritDoc} */
-    public Long getCacheDuration() {
+    public Duration getCacheDuration() {
         return cacheDuration;
     }
 
     /** {@inheritDoc} */
-    public void setCacheDuration(final Long duration) {
+    public void setCacheDuration(final Duration duration) {
         cacheDuration = prepareForAssignment(cacheDuration, duration);
     }
 
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorMarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorMarshaller.java
index 3b3ef45..d4ccd54 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorMarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorMarshaller.java
@@ -17,8 +17,6 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
-import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
-
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.saml.common.AbstractSAMLObjectMarshaller;
 import org.opensaml.saml.config.SAMLConfigurationSupport;
@@ -44,14 +42,14 @@ public class EntitiesDescriptorMarshaller extends AbstractSAMLObjectMarshaller {
 
         // Set the ID attribute
         if (entitiesDescriptor.getID() != null) {
-            log.debug("Writing ID attribute to EntitiesDescriptor DOM element.");
+            log.trace("Writing ID attribute to EntitiesDescriptor DOM element.");
             domElement.setAttributeNS(null, EntitiesDescriptor.ID_ATTRIB_NAME, entitiesDescriptor.getID());
             domElement.setIdAttributeNS(null, EntitiesDescriptor.ID_ATTRIB_NAME, true);
         }
 
         // Set the validUntil attribute
         if (entitiesDescriptor.getValidUntil() != null) {
-            log.debug("Writting validUntil attribute to EntitiesDescriptor DOM element");
+            log.trace("Writting validUntil attribute to EntitiesDescriptor DOM element");
             final String validUntilStr =
                     SAMLConfigurationSupport.getSAMLDateFormatter().format(entitiesDescriptor.getValidUntil());
             domElement.setAttributeNS(null, TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME, validUntilStr);
@@ -59,14 +57,14 @@ public class EntitiesDescriptorMarshaller extends AbstractSAMLObjectMarshaller {
 
         // Set the cacheDuration attribute
         if (entitiesDescriptor.getCacheDuration() != null) {
-            log.debug("Writting cacheDuration attribute to EntitiesDescriptor DOM element");
-            final String cacheDuration = DOMTypeSupport.longToDuration(entitiesDescriptor.getCacheDuration());
-            domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
+            log.trace("Writting cacheDuration attribute to EntitiesDescriptor DOM element");
+            domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME,
+                    entitiesDescriptor.getCacheDuration().toString());
         }
 
         // Set the Name attribute
         if (entitiesDescriptor.getName() != null) {
-            log.debug("Writting Name attribute to EntitiesDescriptor DOM element");
+            log.trace("Writting Name attribute to EntitiesDescriptor DOM element");
             domElement.setAttributeNS(null, EntitiesDescriptor.NAME_ATTRIB_NAME, entitiesDescriptor.getName());
         }
     }
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorUnmarshaller.java
index 2e752ce..dde3290 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorUnmarshaller.java
@@ -69,7 +69,7 @@ public class EntitiesDescriptorUnmarshaller extends AbstractSAMLObjectUnmarshall
                     && !Strings.isNullOrEmpty(attribute.getValue())) {
                 entitiesDescriptor.setValidUntil(Instant.parse(attribute.getValue()));
             } else if (attribute.getLocalName().equals(CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME)) {
-                entitiesDescriptor.setCacheDuration(Long.valueOf(DOMTypeSupport.durationToLong(attribute.getValue())));
+                entitiesDescriptor.setCacheDuration(DOMTypeSupport.durationToDuration(attribute.getValue()));
             } else if (attribute.getLocalName().equals(EntitiesDescriptor.NAME_ATTRIB_NAME)) {
                 entitiesDescriptor.setName(attribute.getValue());
             } else {
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorImpl.java
index 5f0ab66..faa1a51 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorImpl.java
@@ -17,6 +17,7 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
+import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -57,7 +58,7 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
     private Instant validUntil;
 
     /** cacheDurection attribute. */
-    private Long cacheDuration;
+    private Duration cacheDuration;
 
     /** Extensions child. */
     private Extensions extensions;
@@ -141,12 +142,12 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
     }
 
     /** {@inheritDoc} */
-    public Long getCacheDuration() {
+    public Duration getCacheDuration() {
         return cacheDuration;
     }
 
     /** {@inheritDoc} */
-    public void setCacheDuration(final Long duration) {
+    public void setCacheDuration(final Duration duration) {
         cacheDuration = prepareForAssignment(cacheDuration, duration);
     }
 
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorMarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorMarshaller.java
index 75bcd8c..a582850 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorMarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorMarshaller.java
@@ -17,8 +17,6 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
-import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
-
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.saml.common.AbstractSAMLObjectMarshaller;
 import org.opensaml.saml.config.SAMLConfigurationSupport;
@@ -63,8 +61,8 @@ public class EntityDescriptorMarshaller extends AbstractSAMLObjectMarshaller {
         // Set the cacheDuration attribute
         if (entityDescriptor.getCacheDuration() != null) {
             log.debug("Writting cacheDuration attribute to EntityDescriptor DOM element");
-            final String cacheDuration = DOMTypeSupport.longToDuration(entityDescriptor.getCacheDuration());
-            domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
+            domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME,
+                    entityDescriptor.getCacheDuration().toString());
         }
 
         marshallUnknownAttributes(entityDescriptor, domElement);
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorUnmarshaller.java
index 5417205..56ea909 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorUnmarshaller.java
@@ -81,7 +81,7 @@ public class EntityDescriptorUnmarshaller extends AbstractSAMLObjectUnmarshaller
                     && !Strings.isNullOrEmpty(attribute.getValue())) {
                 entityDescriptor.setValidUntil(Instant.parse(attribute.getValue()));
             } else if (attribute.getLocalName().equals(CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME)) {
-                entityDescriptor.setCacheDuration(DOMTypeSupport.durationToLong(attribute.getValue()));
+                entityDescriptor.setCacheDuration(DOMTypeSupport.durationToDuration(attribute.getValue()));
             } else {
                 super.processAttribute(samlObject, attribute);
             }
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorImpl.java
index 33fa9fd..609b2b1 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorImpl.java
@@ -17,6 +17,7 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
+import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -46,7 +47,7 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
     private Instant validUntil;
 
     /** cacheDurection attribute. */
-    private Long cacheDuration;
+    private Duration cacheDuration;
 
     /** Set of supported protocols. */
     private final List<String> supportedProtocols;
@@ -86,13 +87,11 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
     }
 
     /** {@inheritDoc} */
-    @Override
     public String getID() {
         return id;
     }
 
     /** {@inheritDoc} */
-    @Override
     public void setID(final String newID) {
         final String oldID = this.id;
         this.id = prepareForAssignment(this.id, newID);
@@ -100,7 +99,6 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
     }
 
     /** {@inheritDoc} */
-    @Override
     public boolean isValid() {
         if (null == validUntil) {
             return true;
@@ -110,43 +108,36 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
     }
 
     /** {@inheritDoc} */
-    @Override
     public Instant getValidUntil() {
         return validUntil;
     }
 
     /** {@inheritDoc} */
-    @Override
     public void setValidUntil(final Instant dt) {
         validUntil = prepareForAssignment(validUntil, dt);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public Long getCacheDuration() {
+    public Duration getCacheDuration() {
         return cacheDuration;
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void setCacheDuration(final Long duration) {
+    public void setCacheDuration(final Duration duration) {
         cacheDuration = prepareForAssignment(cacheDuration, duration);
     }
 
     /** {@inheritDoc} */
-    @Override
     public List<String> getSupportedProtocols() {
         return Collections.unmodifiableList(supportedProtocols);
     }
 
     /** {@inheritDoc} */
-    @Override
     public boolean isSupportedProtocol(final String protocol) {
         return supportedProtocols.contains(protocol);
     }
 
     /** {@inheritDoc} */
-    @Override
     public void addSupportedProtocol(final String protocol) {
         final String trimmed = StringSupport.trimOrNull(protocol);
         if (trimmed != null && !supportedProtocols.contains(trimmed)) {
@@ -156,7 +147,6 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
     }
 
     /** {@inheritDoc} */
-    @Override
     public void removeSupportedProtocol(final String protocol) {
         final String trimmed = StringSupport.trimOrNull(protocol);
         if (trimmed != null && supportedProtocols.contains(trimmed)) {
@@ -166,7 +156,6 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
     }
 
     /** {@inheritDoc} */
-    @Override
     public void removeSupportedProtocols(final Collection<String> protocols) {
         for (final String protocol : protocols) {
             removeSupportedProtocol(protocol);
@@ -174,62 +163,51 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
     }
 
     /** {@inheritDoc} */
-    @Override
     public void removeAllSupportedProtocols() {
         supportedProtocols.clear();
     }
 
     /** {@inheritDoc} */
-    @Override
     public String getErrorURL() {
         return errorURL;
     }
 
     /** {@inheritDoc} */
-    @Override
     public void setErrorURL(final String url) {
-
         errorURL = prepareForAssignment(errorURL, url);
     }
 
     /** {@inheritDoc} */
-    @Override
     public Extensions getExtensions() {
         return extensions;
     }
 
     /** {@inheritDoc} */
-    @Override
     public void setExtensions(final Extensions ext) {
         extensions = prepareForAssignment(extensions, ext);
     }
 
     /** {@inheritDoc} */
-    @Override
     public Organization getOrganization() {
         return organization;
     }
 
     /** {@inheritDoc} */
-    @Override
     public void setOrganization(final Organization org) {
         organization = prepareForAssignment(organization, org);
     }
 
     /** {@inheritDoc} */
-    @Override
     public List<ContactPerson> getContactPersons() {
         return contactPersons;
     }
 
     /** {@inheritDoc} */
-    @Override
     public List<KeyDescriptor> getKeyDescriptors() {
         return keyDescriptors;
     }
 
     /** {@inheritDoc} */
-    @Override
     public AttributeMap getUnknownAttributes() {
         return unknownAttributes;
     }
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorMarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorMarshaller.java
index 5a0aa15..a63133e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorMarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorMarshaller.java
@@ -19,8 +19,6 @@ package org.opensaml.saml.saml2.metadata.impl;
 
 import java.util.List;
 
-import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
-
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.core.xml.io.MarshallingException;
 import org.opensaml.saml.common.AbstractSAMLObjectMarshaller;
@@ -63,8 +61,8 @@ public abstract class RoleDescriptorMarshaller extends AbstractSAMLObjectMarshal
         // Set the cacheDuration attribute
         if (roleDescriptor.getCacheDuration() != null) {
             log.trace("Writting cacheDuration attribute to EntitiesDescriptor DOM element");
-            final String cacheDuration = DOMTypeSupport.longToDuration(roleDescriptor.getCacheDuration());
-            domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
+            domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME,
+                    roleDescriptor.getCacheDuration().toString());
         }
 
         // Set the protocolSupportEnumeration attribute
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorUnmarshaller.java
index 27418d7..de1ca7a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorUnmarshaller.java
@@ -74,7 +74,7 @@ public abstract class RoleDescriptorUnmarshaller extends AbstractSAMLObjectUnmar
                     && !Strings.isNullOrEmpty(attribute.getValue())) {
                 roleDescriptor.setValidUntil(Instant.parse(attribute.getValue()));
             } else if (attribute.getLocalName().equals(CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME)) {
-                roleDescriptor.setCacheDuration(DOMTypeSupport.durationToLong(attribute.getValue()));
+                roleDescriptor.setCacheDuration(DOMTypeSupport.durationToDuration(attribute.getValue()));
             } else if (attribute.getLocalName().equals(RoleDescriptor.PROTOCOL_ENUMERATION_ATTRIB_NAME)) {
                 final StringTokenizer protocolTokenizer = new StringTokenizer(attribute.getValue(), " ");
                 while (protocolTokenizer.hasMoreTokens()) {
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorTest.java
index 71e13c4..98a36e6 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorTest.java
@@ -17,6 +17,7 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
+import java.time.Duration;
 import java.time.Instant;
 
 import javax.xml.namespace.QName;
@@ -45,8 +46,8 @@ public class AffiliationDescriptorTest extends XMLObjectProviderBaseTestCase {
     /** Expceted ID value */
     protected String expectedID;
 
-    /** Expected cacheDuration value in miliseconds */
-    protected long expectedCacheDuration;
+    /** Expected cacheDuration value. */
+    protected Duration expectedCacheDuration;
 
     /** Expected validUntil value */
     protected Instant expectedValidUntil;
@@ -70,7 +71,7 @@ public class AffiliationDescriptorTest extends XMLObjectProviderBaseTestCase {
     protected void setUp() throws Exception {
         expectedOwnerID = "urn:example.org";
         expectedID = "id";
-        expectedCacheDuration = 90000;
+        expectedCacheDuration = Duration.ofSeconds(90);
         expectedValidUntil = Instant.parse("2005-12-07T10:21:00Z");
     }
 
@@ -83,7 +84,7 @@ public class AffiliationDescriptorTest extends XMLObjectProviderBaseTestCase {
         Assert.assertEquals(ownerId,
                 expectedOwnerID, "entityID attribute has a value of " + ownerId + ", expected a value of " + expectedOwnerID);
 
-        Long duration = descriptor.getCacheDuration();
+        Duration duration = descriptor.getCacheDuration();
         Assert.assertNull(duration, "cacheDuration attribute has a value of " + duration + ", expected no value");
 
         Instant validUntil = descriptor.getValidUntil();
@@ -104,7 +105,7 @@ public class AffiliationDescriptorTest extends XMLObjectProviderBaseTestCase {
         String id = descriptor.getID();
         Assert.assertEquals(id, expectedID, "ID attribute has a value of " + id + ", expected a value of " + expectedID);
 
-        long duration = descriptor.getCacheDuration().longValue();
+        Duration duration = descriptor.getCacheDuration();
         Assert.assertEquals(duration, expectedCacheDuration, "cacheDuration attribute has a value of " + duration + ", expected a value of "
                         + expectedCacheDuration);
 
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorTest.java
index 0ffc7d0..f3aa020 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorTest.java
@@ -21,6 +21,7 @@ import org.testng.annotations.Test;
 import org.testng.annotations.BeforeMethod;
 import org.testng.Assert;
 
+import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
 import java.util.List;
@@ -48,7 +49,7 @@ public class AuthnAuthorityDescriptorTest extends XMLObjectProviderBaseTestCase
     protected List<String> expectedSupportedProtocols;
 
     /** Expected cacheDuration value in miliseconds */
-    protected long expectedCacheDuration;
+    protected Duration expectedCacheDuration;
 
     /** Expected validUntil value */
     protected Instant expectedValidUntil;
@@ -84,7 +85,7 @@ public class AuthnAuthorityDescriptorTest extends XMLObjectProviderBaseTestCase
     @BeforeMethod protected void setUp() throws Exception {
         expectedSupportedProtocols = new ArrayList<>();
         expectedSupportedProtocols.add(SAMLConstants.SAML20P_NS);
-        expectedCacheDuration = 90000;
+        expectedCacheDuration = Duration.ofSeconds(90);
         expectedValidUntil = Instant.parse("2005-12-07T10:21:00Z");
         expectedErrorURL = "http://example.org";
         //
@@ -105,7 +106,7 @@ public class AuthnAuthorityDescriptorTest extends XMLObjectProviderBaseTestCase
         Assert.assertEquals(protoEnum, expectedSupportedProtocols,
                 "Supported protocol enumeration was not equal to expected enumeration");
 
-        Long duration = authnAuthorityObj.getCacheDuration();
+        Duration duration = authnAuthorityObj.getCacheDuration();
         Assert.assertNull(duration, "cacheDuration attribute has a value of " + duration + ", expected no value");
 
         Instant validUntil = authnAuthorityObj.getValidUntil();
@@ -124,7 +125,7 @@ public class AuthnAuthorityDescriptorTest extends XMLObjectProviderBaseTestCase
         Assert.assertEquals(protoEnum, expectedSupportedProtocols,
                 "Supported protocol enumeration was not equal to expected enumeration");
 
-        long duration = authnAuthorityObj.getCacheDuration().longValue();
+        Duration duration = authnAuthorityObj.getCacheDuration();
         Assert.assertEquals(duration, expectedCacheDuration, "cacheDuration attribute has a value of " + duration
                 + ", expected a value of " + expectedCacheDuration);
 
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorTest.java
index eb9fe22..3c51302 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorTest.java
@@ -21,6 +21,7 @@ import org.testng.annotations.Test;
 import org.testng.annotations.BeforeMethod;
 import org.testng.Assert;
 
+import java.time.Duration;
 import java.time.Instant;
 
 import javax.xml.namespace.QName;
@@ -46,7 +47,7 @@ public class EntitiesDescriptorTest extends XMLObjectProviderBaseTestCase {
     protected String expectedID;
 
     /** Expected cacheDuration value in miliseconds */
-    protected long expectedCacheDuration;
+    protected Duration expectedCacheDuration;
 
     /** Expected validUntil value */
     protected Instant expectedValidUntil;
@@ -70,7 +71,7 @@ public class EntitiesDescriptorTest extends XMLObjectProviderBaseTestCase {
     protected void setUp() throws Exception {
         expectedID = "id";
         expectedName = "eDescName";
-        expectedCacheDuration = 90000;
+        expectedCacheDuration = Duration.ofSeconds(90);
         expectedValidUntil = Instant.parse("2005-12-07T10:21:00.000Z");
         expectedEntitiesDescriptorsCount = 3;
         expectedEntityDescriptorsCount = 2;
@@ -84,7 +85,7 @@ public class EntitiesDescriptorTest extends XMLObjectProviderBaseTestCase {
         String name = entitiesDescriptorObj.getName();
         Assert.assertNull(name, "Name attribute has a value of " + name + ", expected no value");
 
-        Long duration = entitiesDescriptorObj.getCacheDuration();
+        Duration duration = entitiesDescriptorObj.getCacheDuration();
         Assert.assertNull(duration, "cacheDuration attribute has a value of " + duration + ", expected no value");
 
         Instant validUntil = entitiesDescriptorObj.getValidUntil();
@@ -104,7 +105,7 @@ public class EntitiesDescriptorTest extends XMLObjectProviderBaseTestCase {
         String id = entitiesDescriptorObj.getID();
         Assert.assertEquals(id, expectedID, "ID attriubte has a value of " + id + ", expected a value of " + expectedID);
 
-        long duration = entitiesDescriptorObj.getCacheDuration().longValue();
+        Duration duration = entitiesDescriptorObj.getCacheDuration();
         Assert.assertEquals(duration, expectedCacheDuration, "cacheDuration attribute has a value of " + duration + ", expected a value of "
                         + expectedCacheDuration);
 
@@ -144,7 +145,7 @@ public class EntitiesDescriptorTest extends XMLObjectProviderBaseTestCase {
 
         entitiesDescriptor.setName(expectedName);
         entitiesDescriptor.setID(expectedID);
-        entitiesDescriptor.setCacheDuration(Long.valueOf(expectedCacheDuration));
+        entitiesDescriptor.setCacheDuration(expectedCacheDuration);
         entitiesDescriptor.setValidUntil(expectedValidUntil);
 
         assertXMLEquals(expectedOptionalAttributesDOM, entitiesDescriptor);
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorTest.java
index c9c7f7c..c9c4fed 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorTest.java
@@ -17,6 +17,7 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
+import java.time.Duration;
 import java.time.Instant;
 
 import javax.xml.namespace.QName;
@@ -55,7 +56,7 @@ public class EntityDescriptorTest extends XMLObjectProviderBaseTestCase {
     protected String expectedID;
 
     /** Expected cacheDuration value in miliseconds */
-    protected long expectedCacheDuration;
+    protected Duration expectedCacheDuration;
 
     /** Expected validUntil value */
     protected Instant expectedValidUntil;
@@ -82,7 +83,7 @@ public class EntityDescriptorTest extends XMLObjectProviderBaseTestCase {
     @BeforeMethod protected void setUp() throws Exception {
         expectedID = "id";
         expectedEntityID = "99ff33";
-        expectedCacheDuration = 90000;
+        expectedCacheDuration = Duration.ofSeconds(90);
         expectedValidUntil = Instant.parse("2005-12-07T10:21:00Z");
     }
 
@@ -94,7 +95,7 @@ public class EntityDescriptorTest extends XMLObjectProviderBaseTestCase {
         Assert.assertEquals(entityID, expectedEntityID, "entityID attribute has a value of " + entityID
                 + ", expected a value of " + expectedEntityID);
 
-        Long duration = descriptor.getCacheDuration();
+        Duration duration = descriptor.getCacheDuration();
         Assert.assertNull(duration, "cacheDuration attribute has a value of " + duration + ", expected no value");
 
         Instant validUntil = descriptor.getValidUntil();
@@ -114,7 +115,7 @@ public class EntityDescriptorTest extends XMLObjectProviderBaseTestCase {
         String id = descriptor.getID();
         Assert.assertEquals(id, expectedID, "ID attribute has a value of " + id + ", expected a value of " + expectedID);
 
-        long duration = descriptor.getCacheDuration().longValue();
+        Duration duration = descriptor.getCacheDuration();
         Assert.assertEquals(duration, expectedCacheDuration, "cacheDuration attribute has a value of " + duration
                 + ", expected a value of " + expectedCacheDuration);
 
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorTest.java
index 00b6f37..27659b2 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorTest.java
@@ -17,6 +17,7 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
+import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
 
@@ -54,7 +55,7 @@ public class IDPSSODescriptorTest extends XMLObjectProviderBaseTestCase {
     protected ArrayList<String> expectedSupportedProtocol;
 
     /** Expected cacheDuration value in miliseconds */
-    protected long expectedCacheDuration;
+    protected Duration expectedCacheDuration;
 
     /** Expected validUntil value */
     protected Instant expectedValidUntil;
@@ -88,7 +89,7 @@ public class IDPSSODescriptorTest extends XMLObjectProviderBaseTestCase {
         expectedSupportedProtocol.add("urn:foo:bar");
         expectedSupportedProtocol.add("urn:fooz:baz");
 
-        expectedCacheDuration = 90000;
+        expectedCacheDuration = Duration.ofSeconds(90);
         expectedValidUntil = Instant.parse("2005-12-07T10:21:00Z");
 
         expectedErrorURL = "http://example.org";
@@ -106,7 +107,7 @@ public class IDPSSODescriptorTest extends XMLObjectProviderBaseTestCase {
     @Test public void testSingleElementOptionalAttributesUnmarshall() {
         IDPSSODescriptor descriptor = (IDPSSODescriptor) unmarshallElement(singleElementOptionalAttributesFile);
 
-        Assert.assertEquals(descriptor.getCacheDuration().longValue(), expectedCacheDuration,
+        Assert.assertEquals(descriptor.getCacheDuration(), expectedCacheDuration,
                 "Cache duration was not expected value");
         Assert.assertEquals(descriptor.getValidUntil(), expectedValidUntil, "ValidUntil was not expected value");
         Assert.assertEquals(descriptor.getWantAuthnRequestsSignedXSBoolean(), expectedWantAuthnReqSigned,
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorTest.java
index 52891ef..9be94b7 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorTest.java
@@ -21,6 +21,7 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
+import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
 
@@ -47,7 +48,7 @@ public class PDPDescriptorTest extends XMLObjectProviderBaseTestCase {
     protected ArrayList<String> expectedSupportedProtocol;
 
     /** Expected cacheDuration value in miliseconds */
-    protected long expectedCacheDuration;
+    protected Duration expectedCacheDuration;
 
     /** Expected validUntil value */
     protected Instant expectedValidUntil;
@@ -70,7 +71,7 @@ public class PDPDescriptorTest extends XMLObjectProviderBaseTestCase {
         expectedSupportedProtocol.add("urn:foo:bar");
         expectedSupportedProtocol.add("urn:fooz:baz");
 
-        expectedCacheDuration = 90000;
+        expectedCacheDuration = Duration.ofSeconds(90);
         expectedValidUntil = Instant.parse("2005-12-07T10:21:00Z");
 
         expectedErrorURL = "http://example.org";
@@ -88,7 +89,7 @@ public class PDPDescriptorTest extends XMLObjectProviderBaseTestCase {
     @Test public void testSingleElementOptionalAttributesUnmarshall() {
         PDPDescriptor descriptor = (PDPDescriptor) unmarshallElement(singleElementOptionalAttributesFile);
 
-        Assert.assertEquals(descriptor.getCacheDuration().longValue(), expectedCacheDuration,
+        Assert.assertEquals(descriptor.getCacheDuration(), expectedCacheDuration,
                 "Cache duration was not expected value");
         Assert.assertEquals(descriptor.getValidUntil(), expectedValidUntil, "ValidUntil was not expected value");
         Assert.assertEquals(descriptor.getErrorURL(), expectedErrorURL, "ErrorURL was not expected value");
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorTest.java
index 36361c9..8f7e54e 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorTest.java
@@ -17,6 +17,7 @@
 
 package org.opensaml.saml.saml2.metadata.impl;
 
+import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
 
@@ -56,7 +57,7 @@ public class SPSSODescriptorTest extends XMLObjectProviderBaseTestCase {
     protected ArrayList<String> expectedSupportedProtocol;
 
     /** Expected cacheDuration value in miliseconds */
-    protected long expectedCacheDuration;
+    protected Duration expectedCacheDuration;
 
     /** Expected validUntil value */
     protected Instant expectedValidUntil;
@@ -82,7 +83,7 @@ public class SPSSODescriptorTest extends XMLObjectProviderBaseTestCase {
         expectedSupportedProtocol.add("urn:foo:bar");
         expectedSupportedProtocol.add("urn:fooz:baz");
 
-        expectedCacheDuration = 90000;
+        expectedCacheDuration = Duration.ofSeconds(90);
         expectedValidUntil = Instant.parse("2005-12-07T10:21:00Z");
         expectedId = "id";
     }
diff --git a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorOptionalAttributes.xml b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorOptionalAttributes.xml
index 5f0b8fd..0ec1987 100644
--- a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorOptionalAttributes.xml
+++ b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorOptionalAttributes.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<md:AffiliationDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" affiliationOwnerID="urn:example.org" ID="id" cacheDuration="P0Y0M0DT0H1M30.000S" validUntil="2005-12-07T10:21:00.000Z"/>
+<md:AffiliationDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" affiliationOwnerID="urn:example.org" ID="id" cacheDuration="PT1M30S" validUntil="2005-12-07T10:21:00.000Z"/>
diff --git a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorOptionalAttributes.xml b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorOptionalAttributes.xml
index 3b31185..6ae64bf 100644
--- a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorOptionalAttributes.xml
+++ b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorOptionalAttributes.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<md:AuthnAuthorityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" cacheDuration="P0Y0M0DT0H1M30.000S" errorURL="http://example.org" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol" validUntil="2005-12-07T10:21:00.000Z"/>
+<md:AuthnAuthorityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" cacheDuration="PT1M30S" errorURL="http://example.org" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol" validUntil="2005-12-07T10:21:00.000Z"/>
diff --git a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorOptionalAttributes.xml b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorOptionalAttributes.xml
index eb84a14..040bcf3 100644
--- a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorOptionalAttributes.xml
+++ b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorOptionalAttributes.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<md:EntitiesDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" Name="eDescName" ID="id" cacheDuration="P0Y0M0DT0H1M30.000S" validUntil="2005-12-07T10:21:00.000Z"/>
+<md:EntitiesDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" Name="eDescName" ID="id" cacheDuration="PT1M30S" validUntil="2005-12-07T10:21:00.000Z"/>
diff --git a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorOptionalAttributes.xml b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorOptionalAttributes.xml
index 91eccf4..d4fcf36 100644
--- a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorOptionalAttributes.xml
+++ b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorOptionalAttributes.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" cacheDuration="P0Y0M0DT0H1M30.000S" entityID="99ff33" ID="id" validUntil="2005-12-07T10:21:00.000Z"/>
+<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" cacheDuration="PT1M30S" entityID="99ff33" ID="id" validUntil="2005-12-07T10:21:00.000Z"/>
diff --git a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorOptionalAttributes.xml b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorOptionalAttributes.xml
index 427a7a1..097abfd 100644
--- a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorOptionalAttributes.xml
+++ b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorOptionalAttributes.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<md:IDPSSODescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" protocolSupportEnumeration="urn:foo:bar urn:fooz:baz" WantAuthnRequestsSigned="true" cacheDuration="P0Y0M0DT0H1M30.000S" validUntil="2005-12-07T10:21:00.000Z" errorURL="http://example.org"/>
+<md:IDPSSODescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" protocolSupportEnumeration="urn:foo:bar urn:fooz:baz" WantAuthnRequestsSigned="true" cacheDuration="PT1M30S" validUntil="2005-12-07T10:21:00.000Z" errorURL="http://example.org"/>
diff --git a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorOptionalAttributes.xml b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorOptionalAttributes.xml
index 77f9008..5f68bc0 100644
--- a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorOptionalAttributes.xml
+++ b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorOptionalAttributes.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<md:PDPDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" protocolSupportEnumeration="urn:foo:bar urn:fooz:baz" cacheDuration="P0Y0M0DT0H1M30.000S" validUntil="2005-12-07T10:21:00.000Z" errorURL="http://example.org"/>
+<md:PDPDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" protocolSupportEnumeration="urn:foo:bar urn:fooz:baz" cacheDuration="PT1M30S" validUntil="2005-12-07T10:21:00.000Z" errorURL="http://example.org"/>
diff --git a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorOptionalAttributes.xml b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorOptionalAttributes.xml
index 03555a0..6946b00 100644
--- a/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorOptionalAttributes.xml
+++ b/opensaml-saml-impl/src/test/resources/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorOptionalAttributes.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<md:SPSSODescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" protocolSupportEnumeration="urn:foo:bar urn:fooz:baz" cacheDuration="P0Y0M0DT0H1M30.000S" validUntil="2005-12-07T10:21:00.000Z" AuthnRequestsSigned="true" WantAssertionsSigned="true"/>
+<md:SPSSODescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" protocolSupportEnumeration="urn:foo:bar urn:fooz:baz" cacheDuration="PT1M30S" validUntil="2005-12-07T10:21:00.000Z" AuthnRequestsSigned="true" WantAssertionsSigned="true"/>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list