[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src: main/java/org/opensaml/saml/common/binding/security/impl/Mes...

noreply at shibboleth.net noreply at shibboleth.net
Thu Mar 24 16:10:27 EDT 2016


Author: scantor
Date: Thu Mar 24 16:10:26 2016
New Revision: 4436

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4436&view=rev
Log:
OSJ-158 - Mixture of time zones in log output in message handler

https://issues.shibboleth.net/jira/browse/OSJ-158

Instantiate current time in UTC.

Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandler.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandlerTest.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandler.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandler.java?rev=4436&r1=4435&r2=4436&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandler.java	(original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandler.java	Thu Mar 24 16:10:26 2016
@@ -25,6 +25,7 @@
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
 import org.opensaml.messaging.context.MessageContext;
 import org.opensaml.messaging.handler.AbstractMessageHandler;
 import org.opensaml.messaging.handler.MessageHandlerException;
@@ -51,10 +52,9 @@
     
     /** Whether this rule is required to be met. */
     private boolean requiredRule;
-
+    
     /** Constructor. */
     public MessageLifetimeSecurityHandler() {
-        super();
         clockSkew = 60 * 3 * 1000;
         messageLifetime = 180 * 1000;
         requiredRule = true;
@@ -136,7 +136,7 @@
         }
 
         final DateTime issueInstant = msgInfoContext.getMessageIssueInstant();
-        final DateTime now = new DateTime();
+        final DateTime now = new DateTime(DateTimeZone.UTC);
         final DateTime latestValid = now.plus(getClockSkew());
         final DateTime expiration = issueInstant.plus(getClockSkew() + getMessageLifetime());
 
@@ -144,13 +144,13 @@
         if (issueInstant.isAfter(latestValid)) {
             log.warn("{} Message was not yet valid: message time was {}, latest valid is: {}", getLogPrefix(),
                     issueInstant, latestValid);
-            throw new MessageHandlerException("Message was rejected because was issued in the future");
+            throw new MessageHandlerException("Message was rejected because it was issued in the future");
         }
 
         // Check message has not expired
         if (expiration.isBefore(now)) {
             log.warn(
-                    "{} Message was expired: message issue time was '{}', message expired at: '{}', current time: '{}'",
+                    "{} Message was expired: message time was '{}', message expired at: '{}', current time: '{}'",
                     getLogPrefix(), issueInstant, expiration, now);
             throw new MessageHandlerException("Message was rejected due to issue instant expiration");
         }

Modified: trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandlerTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandlerTest.java?rev=4436&r1=4435&r2=4436&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandlerTest.java	(original)
+++ trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/common/binding/security/impl/MessageLifetimeSecurityHandlerTest.java	Thu Mar 24 16:10:26 2016
@@ -18,6 +18,7 @@
 package org.opensaml.saml.common.binding.security.impl;
 
 import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
 import org.opensaml.core.xml.XMLObjectBaseTestCase;
 import org.opensaml.messaging.context.MessageContext;
 import org.opensaml.messaging.handler.MessageHandlerException;
@@ -43,7 +44,7 @@
 
     @BeforeMethod
     protected void setUp() throws Exception {
-        now = new DateTime();
+        now = new DateTime(DateTimeZone.UTC);
         clockSkew = 60*5*1000;
         messageLifetime = 60*10*1000;
         



More information about the commits mailing list