Closed agarman closed 10 years ago
Here is a better minimal test: (-> {"i/s" "foo"} jwt ; :claims {"i/s" "foo"} (sign "abc") to-str str->jwt ; :claims {:i/s "foo"} (verify "abc")) ; fails because first claim is signed, not second.
I fixed the bug. Please check ver 0.0.7
(-> {"i/s" "foo"} jwt ; :claims {"i/s" "foo"} (sign "abc") to-str str->jwt ; :claims {:/s "foo"} (verify "abc"))
This verifies, but the claim is wrong.
fixed
(-> {"i/s" "foo"}
jwt ; #clj_jwt.core.JWT{:header {:alg "none", :typ "JWT"}, :claims {"i/s" "foo"}, :signature ""}
(sign "abc") ; #clj_jwt.core.JWT{:header {:alg "HS256", :typ "JWT"}, :claims {"i/s" "foo"}, :signature "iSJgf8MitAlJQz-CGeHcKKY0JTb1_FG4o6AE8Sp-Rgc"}
to-str
str->jwt ; #clj_jwt.core.JWT{:header {:alg "HS256", :typ "JWT"}, :claims {"i/s" "foo"}, :signature "iSJgf8MitAlJQz-CGeHcKKY0JTb1_FG4o6AE8Sp-Rgc"}
(verify "abc")) ; true
Looks good.
To reproduce bug:
(def claim {:iss "abc", :iat (now), "http://abc.net" true}) (def token (-> claim jwt (sign :HS256 "foo") to-str)) (verify (str->jwt token) "foo")