Skip to content

Commit 8ce1e64

Browse files
committed
Bump jwt-cpp to version 0.7.1,
downloaded from https://github.com/Thalhammer/jwt-cpp/releases/tag/v0.7.1 jwt-cpp 0.7.1 removes the "get_payload_claims" method, and replaces it with "get_payload_json", which returns a json document, not a map. More importantly for us, jwt-cpp 0.7.1 also fixes warnings about deprecated wstring uses, so we can be warning-clean on g++ 15.
1 parent c9f8bcf commit 8ce1e64

File tree

107 files changed

+3444
-32567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+3444
-32567
lines changed

src/scitokens.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ int scitoken_get_expiration(const SciToken token, long long *expiry,
226226

227227
long long result;
228228
try {
229-
result = real_token->get_claim("exp").as_int();
229+
result = real_token->get_claim("exp").to_json().get<int64_t>();
230230
} catch (std::exception &exc) {
231231
if (err_msg) {
232232
*err_msg = strdup(exc.what());

src/scitokens_internal.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,14 @@ std::string normalize_absolute_path(const std::string &path) {
576576
}
577577

578578
} // namespace
579+
//
580+
static std::unordered_map<std::string, jwt::claim> json_to_claim_map(const picojson::object &json) {
581+
std::unordered_map<std::string, jwt::claim> m;
582+
for (const auto &[name, value]: json) {
583+
m.emplace(name, jwt::claim(value));
584+
}
585+
return m; //nvro
586+
}
579587

580588
void SciToken::deserialize(const std::string &data,
581589
const std::vector<std::string> allowed_issuers) {
@@ -588,7 +596,7 @@ void SciToken::deserialize(const std::string &data,
588596
val.verify(*m_decoded);
589597

590598
// Set all the claims
591-
m_claims = m_decoded->get_payload_claims();
599+
m_claims = json_to_claim_map(m_decoded->get_payload_json());
592600

593601
// Copy over the profile
594602
m_profile = val.get_profile();
@@ -616,7 +624,7 @@ SciToken::deserialize_continue(std::unique_ptr<SciTokenAsyncStatus> status) {
616624
// Check if the status is completed (verification is complete)
617625
if (status->m_status->m_done) {
618626
// Set all the claims
619-
m_claims = m_decoded->get_payload_claims();
627+
m_claims = json_to_claim_map(m_decoded->get_payload_json());
620628

621629
// Copy over the profile
622630
m_profile = status->m_validator->get_profile();
@@ -625,7 +633,7 @@ SciToken::deserialize_continue(std::unique_ptr<SciTokenAsyncStatus> status) {
625633
std::move(status->m_status));
626634
if (status->m_status->m_done) {
627635
// Set all the claims
628-
m_claims = m_decoded->get_payload_claims();
636+
m_claims = json_to_claim_map(m_decoded->get_payload_json());
629637

630638
// Copy over the profile
631639
m_profile = status->m_validator->get_profile();

src/scitokens_internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class SciTokenKey {
156156
: m_kid(key_id), m_name(algorithm), m_public(public_contents),
157157
m_private(private_contents) {}
158158

159-
std::string serialize(jwt::builder<jwt::traits::kazuho_picojson> &builder) {
159+
std::string serialize(jwt::builder<jwt::default_clock, jwt::traits::kazuho_picojson> &builder) {
160160
if (m_kid != "none") {
161161
builder.set_key_id(m_kid);
162162
}
@@ -327,7 +327,7 @@ class SciToken {
327327
void set_lifetime(int lifetime) { m_lifetime = lifetime; }
328328

329329
std::string serialize() {
330-
jwt::builder<jwt::traits::kazuho_picojson> builder(jwt::create());
330+
auto builder(jwt::create());
331331

332332
if (!m_issuer_set) {
333333
throw MissingIssuerException();
@@ -614,7 +614,7 @@ class Validator {
614614
must_verify_everything = m_validate_all_claims;
615615
}
616616

617-
auto claims = jwt.get_payload_claims();
617+
auto claims = jwt.get_payload_json();
618618
for (const auto &claim_pair : claims) {
619619
if (claim_pair.first == "iat" || claim_pair.first == "nbf" ||
620620
claim_pair.first == "exp" || claim_pair.first == "ver") {

src/test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ int main(int argc, const char **argv) {
1616

1717
auto decoded = jwt::decode(token);
1818

19-
for (auto &e : decoded.get_payload_claims())
20-
std::cout << e.first << " = " << e.second.to_json() << std::endl;
19+
for (auto &e : decoded.get_payload_json())
20+
std::cout << e.first << " = " << e.second << std::endl;
2121

2222
std::ifstream priv_ifs("test.pem");
2323
std::string private_contents((std::istreambuf_iterator<char>(priv_ifs)),
@@ -57,8 +57,8 @@ int main(int argc, const char **argv) {
5757
std::cout << "SciToken: " << value << std::endl;
5858
auto decoded2 = jwt::decode(value);
5959

60-
for (auto &e : decoded2.get_payload_claims())
61-
std::cout << e.first << " = " << e.second.to_json() << std::endl;
60+
for (auto &e : decoded2.get_payload_json())
61+
std::cout << e.first << " = " << e.second << std::endl;
6262

6363
scitoken_destroy(scitoken);
6464
scitoken_key_destroy(key);

vendor/jwt-cpp/.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[!*.{h,cpp}]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.{h,cpp}]
12+
indent_style = tab
13+
trim_trailing_whitespace = true
14+
insert_final_newline = true
15+
16+
[*.md]
17+
trim_trailing_whitespace = false

vendor/jwt-cpp/.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: [Thalhammer,prince-chrismc]
2+
patreon: Thalhammer
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Bug Report 🐛
2+
description: File a bug report
3+
4+
labels: ["bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this bug report!
10+
validations:
11+
required: false
12+
- type: textarea
13+
id: what-happened
14+
attributes:
15+
label: What happened?
16+
description: Also tell us, what did you expect to happen? Feel free to include some screenshots
17+
placeholder: Tell us what you see!
18+
value: "A bug happened!"
19+
validations:
20+
required: true
21+
- type: textarea
22+
id: reproduce
23+
attributes:
24+
label: How To Reproduce?
25+
description: Please provide a small snippet to reproduce the issue
26+
placeholder: Some C++ code or Shell code to recreate th problem
27+
value: |
28+
```c++
29+
#include "jwt-cpp/jwt.h"
30+
int main() {
31+
return 0;
32+
}
33+
```
34+
- type: dropdown
35+
id: version
36+
attributes:
37+
label: Version
38+
description: What version of our software are you running?
39+
options:
40+
- 0.7.1
41+
- 0.7.0
42+
- 0.6.0
43+
- 0.5.2
44+
- Older (please let us know if the "What happened" box)
45+
validations:
46+
required: true
47+
- type: dropdown
48+
id: operating-system
49+
attributes:
50+
label: What OS are you seeing the problem on?
51+
multiple: true
52+
options:
53+
- Windows
54+
- Linux
55+
- MacOS
56+
- Other (please let us know if the "What happened" box)
57+
validations:
58+
required: true
59+
- type: dropdown
60+
id: compiler
61+
attributes:
62+
label: What compiler are you seeing the problem on?
63+
multiple: true
64+
options:
65+
- GCC
66+
- Clang
67+
- MSVC
68+
- Other (please let us know if the "What happened" box)
69+
validations:
70+
required: true
71+
- type: textarea
72+
id: logs
73+
attributes:
74+
label: Relevant log output
75+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
76+
render: shell
77+
- type: checkboxes
78+
id: terms
79+
attributes:
80+
label: Code of Conduct
81+
description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com)
82+
options:
83+
- label: I agree to follow this project's Code of Conduct
84+
required: true
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Feature Request 🧪
2+
description: Have a great idea? Find something is missing?
3+
labels: ["enhancement"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
We'd love to hear your idea(s)!
9+
- type: input
10+
id: question
11+
attributes:
12+
label: "What would you like to see added?"
13+
validations:
14+
required: true
15+
- type: textarea
16+
id: context
17+
attributes:
18+
label: Additional Context
19+
validations:
20+
required: true
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Support Question 🤹
2+
description: Have some questions? We can offer help.
3+
labels: ["question"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Don't hesitate to ask any question you might have!
9+
- type: input
10+
id: question
11+
attributes:
12+
label: "What's your question?"
13+
validations:
14+
required: true
15+
- type: textarea
16+
id: context
17+
attributes:
18+
label: Additional Context
19+
validations:
20+
required: true
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Regular badging sequence
2+
description: Publishes a badge based on the job status
3+
inputs:
4+
category:
5+
description: The subfolder where to group the badges
6+
required: true
7+
label:
8+
description: The label to you in the badge (this should be unique for each badge in a category)
9+
required: true
10+
github_token:
11+
description: The token to use to publish the changes
12+
required: false
13+
default: ${{ github.token }}
14+
runs:
15+
using: composite
16+
steps:
17+
- if: job.status == 'success'
18+
uses: ./.github/actions/badge/write
19+
with:
20+
category: ${{ inputs.category }}
21+
label: ${{ inputs.label }}
22+
- if: job.status == 'failure'
23+
uses: ./.github/actions/badge/write
24+
with:
25+
category: ${{ inputs.category }}
26+
label: ${{ inputs.label }}
27+
message: Failing
28+
color: red
29+
- uses: ./.github/actions/badge/publish
30+
with:
31+
github_token: ${{ inputs.github_token }}

0 commit comments

Comments
 (0)