mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-14 16:58:34 +00:00
Add option to remove type fromt he jwt_header #26
This commit is contained in:
parent
87dcef903f
commit
129731da56
4 changed files with 84 additions and 14 deletions
|
@ -156,6 +156,22 @@ TEST (DecodeTest, DecodeHS512)
|
|||
EXPECT_TRUE (obj.payload().has_claim_with_value("sub", "nothing much"));
|
||||
}
|
||||
|
||||
TEST (DecodeTest, TypHeaderMiss)
|
||||
{
|
||||
using namespace jwt::params;
|
||||
|
||||
const char* enc_str =
|
||||
"eyJhbGciOiJIUzI1NiJ9."
|
||||
"eyJleHAiOjE1MzM0NjE1NTMsImlhdCI6MTUxMzg2MjM3MSwiaWQiOiJhLWItYy1kLWUtZi0xLTItMyIsImlzcyI6ImFydW4ubXVyYWxpZGhhcmFuIiwic3ViIjoiYWRtaW4ifQ."
|
||||
"pMWBLSWl1p4V958lfe_6ZhvgFMOQv9Eq5mlndVKFKkA";
|
||||
|
||||
std::error_code ec;
|
||||
auto obj = jwt::decode(enc_str, algorithms({"none", "hs256"}), ec, verify(false));
|
||||
std::cout << "Decode header: " << obj.header() << std::endl;
|
||||
|
||||
EXPECT_FALSE (ec);
|
||||
}
|
||||
|
||||
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