Let assertion validity checks to be more flexible

when comparing dates.
This commit is contained in:
Misagh Moayyed 2016-09-07 15:47:04 +04:30
parent 7cb5380e75
commit 9d4cafd2c9
2 changed files with 11 additions and 0 deletions

View File

@ -101,26 +101,32 @@ public final class AssertionImpl implements Assertion {
CommonUtils.assertNotNull(this.attributes, "attributes cannot be null.");
}
@Override
public Date getAuthenticationDate() {
return this.authenticationDate;
}
@Override
public Date getValidFromDate() {
return this.validFromDate;
}
@Override
public Date getValidUntilDate() {
return this.validUntilDate;
}
@Override
public Map<String, Object> getAttributes() {
return this.attributes;
}
@Override
public AttributePrincipal getPrincipal() {
return this.principal;
}
@Override
public boolean isValid() {
if (this.validFromDate == null) {
return true;

View File

@ -49,6 +49,11 @@ public final class AssertionImplTests extends TestCase {
assertNull(assertion.getPrincipal().getProxyTicketFor("test"));
}
public void testAssertionValidity() throws Exception {
final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL, CONST_ATTRIBUTES);
assertTrue(assertion.isValid());
}
public void testCompleteConstructor() {
final Assertion assertion = new AssertionImpl(CONST_PRINCIPAL, CONST_ATTRIBUTES);