mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-14 16:58:34 +00:00
Added tests for invalid signature
This commit is contained in:
parent
a5728dd397
commit
3bb3c6cf3b
1 changed files with 13 additions and 0 deletions
|
@ -181,6 +181,19 @@ TEST (DecodeVerify, InvalidIATTest)
|
||||||
EXPECT_EQ (ec.value(), static_cast<int>(jwt::VerificationErrc::TypeConversionError));
|
EXPECT_EQ (ec.value(), static_cast<int>(jwt::VerificationErrc::TypeConversionError));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST (DecodeVerify, InvalidSignatureTest)
|
||||||
|
{
|
||||||
|
using namespace jwt::params;
|
||||||
|
|
||||||
|
std::error_code ec;
|
||||||
|
auto dec_obj = jwt::decode("", algorithms({"hs256"}), ec, secret("secret"), validate_iat(true));
|
||||||
|
EXPECT_EQ (ec.value(), static_cast<int>(jwt::DecodeErrc::SignatureFormatError));
|
||||||
|
|
||||||
|
ec.clear();
|
||||||
|
dec_obj = jwt::decode("abcdsdfhbsdhjfbsdj.", algorithms({"hs256"}), ec, secret("secret"), validate_iat(true));
|
||||||
|
EXPECT_EQ (ec.value(), static_cast<int>(jwt::DecodeErrc::SignatureFormatError));
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue