Skip to content

Commit

Permalink
Add iat test
Browse files Browse the repository at this point in the history
  • Loading branch information
jclem committed Oct 22, 2018
1 parent de78a61 commit 13518d2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/post2slack/state_token_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ defmodule Post2Slack.StateTokenTest do
assert StateToken.verify_token(token) == {:error, :invalid_token}
end

test "errors for an invalid iat" do
token =
%Token{}
|> with_signer(hs256(Config.fetch!(:post2slack, :state_signing_secret)))
|> with_iat(current_time() + 60)
|> with_exp(current_time())
|> sign
|> get_compact

assert StateToken.verify_token(token) == {:error, :invalid_token}
end

test "errors for an expired token" do
token =
%Token{}
Expand Down

0 comments on commit 13518d2

Please sign in to comment.