Skip to content

Commit 1220e85

Browse files
author
Roland Hedberg
committed
Merge pull request #312 from knaperek/fix-timestamp-validation-error-message
Fix timestamp validation error message
2 parents 0e4f5fa + 9a3b384 commit 1220e85

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/saml2/validate.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def validate_on_or_after(not_on_or_after, slack):
9191
nooa = calendar.timegm(time_util.str_to_time(not_on_or_after))
9292
if now > nooa + slack:
9393
raise ResponseLifetimeExceed(
94-
"Can't use it, it's too old %d > %d".format(nooa, now))
94+
"Can't use it, it's too old %d > %d".format(now - slack, nooa))
9595
return nooa
9696
else:
9797
return False
@@ -102,8 +102,7 @@ def validate_before(not_before, slack):
102102
now = time_util.utc_now()
103103
nbefore = calendar.timegm(time_util.str_to_time(not_before))
104104
if nbefore > now + slack:
105-
raise ToEarly("Can't use it yet %d <= %d" % (nbefore,
106-
now))
105+
raise ToEarly("Can't use it yet %d <= %d" % (now + slack, nbefore))
107106

108107
return True
109108

0 commit comments

Comments
 (0)