Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop rejecting tokens with future :iat values. #49

Merged
merged 1 commit into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions src/buddy/sign/jwt.clj
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,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