mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-14 16:58:34 +00:00
Added checks and tests for iat/jti/sub
This commit is contained in:
parent
babdd4f0a6
commit
7ddf7ec3e9
9 changed files with 284 additions and 3 deletions
|
@ -164,6 +164,18 @@ TEST (DecodeVerifyExp, KeyNotPresentTest)
|
|||
jwt::KeyNotPresentError);
|
||||
}
|
||||
|
||||
TEST (DecodeVerifyExp, InvalidSubjectTest)
|
||||
{
|
||||
using namespace jwt::params;
|
||||
|
||||
jwt::jwt_object obj{algorithm("hs256"), secret("secret"), payload({{"sub", "test"}, {"aud", "www"}})};
|
||||
|
||||
auto enc_str = obj.signature();
|
||||
|
||||
EXPECT_THROW (jwt::decode(enc_str, algorithms({"hs256"}), secret("secret"), sub("TEST")),
|
||||
jwt::InvalidSubjectError);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue