Skip to content

Commit

Permalink
Stop rejecting tokens with future :iat values.
Browse files Browse the repository at this point in the history
Partially addresses #39.
  • Loading branch information
metametadata authored and niwinz committed Aug 2, 2017
1 parent 7243219 commit 4f5a082
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/buddy/sign/jwt.clj
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
(when (and (:nbf claims) (< now (:nbf claims)))
(throw (ex-info (format "Token is not yet valid (%s)" (:nbf claims))
{:type :validation :cause :nbf})))
(when (and (:iat claims) (< now (:iat claims)))
(throw (ex-info (format "Token is from the future (%s)" (:iat claims))
{:type :validation :cause :iat})))
(when (and (:iat claims) (number? max-age) (> (- now (:iat claims)) max-age))
(throw (ex-info (format "Token is older than max-age (%s)" max-age)
{:type :validation :cause :max-age})))
Expand Down
8 changes: 0 additions & 8 deletions test/buddy/sign/jwt_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,6 @@
signed (make-jwt-fn candidate)]
(unsign-exp-succ signed candidate)))

(testing ":iat claim validation"
(let [candidate {:foo "bar" :iat 10}
signed (make-jwt-fn candidate)]
(unsign-exp-fail signed :iat {:now 0})
(unsign-exp-fail signed :iat {:now 9})
(unsign-exp-succ signed candidate {:now 10})
(unsign-exp-succ signed candidate {:now 11})))

(testing ":exp claim validation"
(let [candidate {:foo "bar" :exp 10}
signed (make-jwt-fn candidate)]
Expand Down

0 comments on commit 4f5a082

Please sign in to comment.