Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/main/java/com/coveo/saml/ValidatorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,13 @@ private static void enforceConditions(Conditions conditions, Instant _now, long
throws SamlException {
Instant now = _now != null ? _now : Instant.now();

Instant notBefore = conditions.getNotBefore();
Instant skewedNotBefore = notBefore.minusSeconds(notBeforeSkew);
if (now.isBefore(skewedNotBefore)) {
throw new SamlException("The assertion cannot be used before " + notBefore.toString());

if (conditions.getNotBefore() != null) {
Instant notBefore = conditions.getNotBefore();
Instant skewedNotBefore = notBefore.minusSeconds(notBeforeSkew);
if (now.isBefore(skewedNotBefore)) {
throw new SamlException("The assertion cannot be used before " + notBefore.toString());
}
}

Instant notOnOrAfter = conditions.getNotOnOrAfter();
Expand Down