🔭 Allow generic access to JWT header and payload (#251)

* boost print header claims

* type

* update other example

* lint

* update example

* update example

* update examples

* tidy

* renaming to clarity

* delete old check in traits

* return underlying type
This commit is contained in:
Chris Mc
2022-10-02 08:47:10 +02:00
committed by GitHub
parent 0628011aeb
commit cba92ab173
10 changed files with 23 additions and 47 deletions

View File

@@ -34,6 +34,9 @@ int main() {
.sign(jwt::algorithm::none{});
const auto decoded = jwt::decode<traits>(token);
for (auto& e : decoded.get_header_json())
std::cout << e.key() << " = " << e.value() << std::endl;
const auto array =
traits::as_array(decoded.get_payload_claim("object").to_json().as_object()["api"].as_object()["array"]);
std::cout << "payload /object/api/array = " << array << std::endl;