MCPcopy Create free account
hub / github.com/arun11299/cpp-jwt / TEST

Function TEST

tests/test_jwt_decode.cc:5–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include "jwt/jwt.hpp"
4
5TEST (DecodeTest, InvalidFinalDotForNoneAlg)
6{
7 using namespace jwt::params;
8 const char* inv_enc_str =
9 "eyJhbGciOiJOT05FIiwidHlwIjoiSldUIn0.eyJhdWQiOiJyaWZ0LmlvIiwiZXhwIjoxNTEzODYzMzcxLCJzdWIiOiJub3RoaW5nIG11Y2gifQ";
10
11 std::error_code ec;
12 auto obj = jwt::decode(inv_enc_str, algorithms({"none", "HS256"}), ec);
13
14 ASSERT_TRUE (ec);
15 EXPECT_EQ (ec.value(), static_cast<int>(jwt::DecodeErrc::SignatureFormatError));
16}
17
18TEST (DecodeTest, DecodeNoneAlgSign)
19{

Callers

nothing calls this directly

Calls 8

algorithmsFunction · 0.85
verifyFunction · 0.85
secretFunction · 0.85
payloadMethod · 0.80
has_claim_with_valueMethod · 0.80
headerMethod · 0.80
valueMethod · 0.45
has_claimMethod · 0.45

Tested by

no test coverage detected