Handle date equality when checking for saml assertion validity

This commit is contained in:
Misagh Moayyed 2016-09-07 16:10:16 +04:30
parent 9d4cafd2c9
commit 9e95ee5825
2 changed files with 4 additions and 2 deletions

View File

@ -133,6 +133,7 @@ public final class AssertionImpl implements Assertion {
}
final Date now = new Date();
return this.validFromDate.before(now) && (this.validUntilDate == null || this.validUntilDate.after(now));
return (this.validFromDate.before(now) || this.validFromDate.equals(now))
&& (this.validUntilDate == null || this.validUntilDate.after(now) || this.validUntilDate.equals(now));
}
}

View File

@ -18,6 +18,7 @@
*/
package org.jasig.cas.client.validation;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase;
@ -50,7 +51,7 @@ public final class AssertionImplTests extends TestCase {
}
public void testAssertionValidity() throws Exception {
final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL, CONST_ATTRIBUTES);
final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL, new Date(), new Date(), new Date(), CONST_ATTRIBUTES);
assertTrue(assertion.isValid());
}