[java-opensaml COMMIT] /trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/assertion/impl/OneTimeUseCondi...

noreply at shibboleth.net noreply at shibboleth.net
Fri Jun 5 13:05:41 EDT 2015


Author: putmanb
Date: Fri Jun  5 13:05:40 2015
New Revision: 4285

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4285&view=rev
Log:
Gracefully handle erroneous one-time-use expiration values which are negative.

Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/assertion/impl/OneTimeUseConditionValidator.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/assertion/impl/OneTimeUseConditionValidator.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/assertion/impl/OneTimeUseConditionValidator.java?rev=4285&r1=4284&r2=4285&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/assertion/impl/OneTimeUseConditionValidator.java	(original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/assertion/impl/OneTimeUseConditionValidator.java	Fri Jun  5 13:05:40 2015
@@ -89,6 +89,10 @@
         replayCacheExpires = expires;
         if (replayCacheExpires == null) {
             replayCacheExpires = DEFAULT_CACHE_EXPIRES;
+        } else if (replayCacheExpires < 0) {
+            log.warn("Supplied value for replay cache expires '{}' was negative, using default expiration", 
+                    replayCacheExpires);
+            replayCacheExpires = DEFAULT_CACHE_EXPIRES;
         }
     }
 
@@ -151,9 +155,15 @@
             log.warn("Value of param was not a Long: {}", ONE_TIME_USE_EXPIRES_PARAM);
         }
         log.debug("Saw one-time use cache expires context param: {}", expires);
+        
         if (expires == null) {
             expires = getReplayCacheExpires();
-        }
+        } else if (expires < 0) {
+            log.warn("Supplied context param for replay cache expires '{}' was negative, using configured expiration", 
+                    expires);
+            expires = getReplayCacheExpires();
+        }
+             
         log.debug("Effective one-time use cache expires of: {}", expires);
         
         long computedExpiration = System.currentTimeMillis() + expires;



More information about the commits mailing list