commit
9294fbdffd
|
|
@ -69,4 +69,12 @@ public interface Assertion extends Serializable {
|
|||
* @return the principal.
|
||||
*/
|
||||
AttributePrincipal getPrincipal();
|
||||
|
||||
/**
|
||||
* Determines whether an Assertion is considered usable or not. A naive implementation may just check the date validity.
|
||||
*
|
||||
* @return true if its valid, false otherwise.
|
||||
* @since 3.3.0 (though in 3.3.0, no one actually calls this)
|
||||
*/
|
||||
boolean isValid();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,4 +121,13 @@ public final class AssertionImpl implements Assertion {
|
|||
public AttributePrincipal getPrincipal() {
|
||||
return this.principal;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
if (this.validFromDate == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final Date now = new Date();
|
||||
return this.validFromDate.before(now) && (this.validUntilDate == null || this.validUntilDate.after(now));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue