From f353707c55e685e1629f717edda688d265896696 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 10:53:45 -0400 Subject: [PATCH 01/12] use ubuntu-latest + update actions/cache --- .github/actions/install/cmake/action.yml | 2 +- .github/workflows/cmake.yml | 2 +- .github/workflows/lint.yml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/install/cmake/action.yml b/.github/actions/install/cmake/action.yml index a018583f..ad8c42e7 100644 --- a/.github/actions/install/cmake/action.yml +++ b/.github/actions/install/cmake/action.yml @@ -12,7 +12,7 @@ runs: steps: - name: Cache CMake id: cache-cmake - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: cmake-${{ inputs.version }} key: ${{ runner.name }}-${{ runner.os }}-${{ runner.arch }}-${{ job.container.id }}-cmake-${{ inputs.version }} diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2d92fc9e..d7318752 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,7 +71,7 @@ jobs: cmake --build . min-req: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: ./.github/actions/install/cmake diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6d8410b3..0c57e8ac 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -30,7 +30,7 @@ jobs: linter_name: clang-format cmake-format: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -48,7 +48,7 @@ jobs: linter_name: cmake-format clang-tidy: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - run: sudo apt-get install clang-tidy - uses: lukka/get-cmake@latest @@ -118,7 +118,7 @@ jobs: linter_name: render-tests line-ending: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: git add --renormalize . From f8fcd7634e644fef235c55ff6dbd48819f7794de Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 11:58:42 -0400 Subject: [PATCH 02/12] performance-avoid-endl https://clang.llvm.org/extra/clang-tidy/checks/performance/avoid-endl.html --- README.md | 2 +- example/es256k.cpp | 6 +++--- example/jwks-verify.cpp | 4 ++-- example/partial-claim-verifier.cpp | 10 +++++----- example/print-claims.cpp | 2 +- example/private-claims.cpp | 2 +- example/rsa-create.cpp | 2 +- example/rsa-verify.cpp | 4 ++-- example/traits/boost-json.cpp | 4 ++-- example/traits/danielaparker-jsoncons.cpp | 2 +- example/traits/kazuho-picojson.cpp | 2 +- example/traits/nlohmann-json.cpp | 2 +- example/traits/open-source-parsers-jsoncpp.cpp | 2 +- include/jwt-cpp/jwt.h | 2 +- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 74800cf8..0ed3d2eb 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ int main() { auto decoded = jwt::decode(token); for(auto& e : decoded.get_payload_json()) - std::cout << e.first << " = " << e.second << std::endl; + std::cout << e.first << " = " << e.second << '\n'; } ``` diff --git a/example/es256k.cpp b/example/es256k.cpp index 1993413b..0ba70192 100644 --- a/example/es256k.cpp +++ b/example/es256k.cpp @@ -24,7 +24,7 @@ K9EDZi0mZ7VUeeNKq476CU5X940yusahgneePQrDMF2nWFEtBCOiXQ== .set_payload_claim("sample", jwt::claim(std::string{"test"})) .sign(jwt::algorithm::es256k(es256k_pub_key, es256k_priv_key, "", "")); - std::cout << "token:\n" << token << std::endl; + std::cout << "token:\n" << token << '\n'; auto verify = jwt::verify() .allow_algorithm(jwt::algorithm::es256k(es256k_pub_key, es256k_priv_key, "", "")) @@ -35,7 +35,7 @@ K9EDZi0mZ7VUeeNKq476CU5X940yusahgneePQrDMF2nWFEtBCOiXQ== verify.verify(decoded); for (auto& e : decoded.get_header_json()) - std::cout << e.first << " = " << e.second << std::endl; + std::cout << e.first << " = " << e.second << '\n'; for (auto& e : decoded.get_payload_json()) - std::cout << e.first << " = " << e.second << std::endl; + std::cout << e.first << " = " << e.second << '\n'; } diff --git a/example/jwks-verify.cpp b/example/jwks-verify.cpp index a9e80f24..fa966e35 100644 --- a/example/jwks-verify.cpp +++ b/example/jwks-verify.cpp @@ -111,7 +111,7 @@ ARS9Ln8Wh5RsFuw/Y7Grg8FsoAVzV/Pns4cwjZG75ezXfk4UVpr4oO4B5jzazzCR auto x5c = jwk.get_x5c_key_value(); if (!x5c.empty() && !issuer.empty()) { - std::cout << "Verifying with 'x5c' key" << std::endl; + std::cout << "Verifying with 'x5c' key" << '\n'; auto verifier = jwt::verify() .allow_algorithm(jwt::algorithm::rs256(jwt::helper::convert_base64_der_to_pem(x5c), "", "", "")) @@ -123,7 +123,7 @@ ARS9Ln8Wh5RsFuw/Y7Grg8FsoAVzV/Pns4cwjZG75ezXfk4UVpr4oO4B5jzazzCR } // else if the optional 'x5c' was not present { - std::cout << "Verifying with RSA components" << std::endl; + std::cout << "Verifying with RSA components" << '\n'; const auto modulus = jwk.get_jwk_claim("n").as_string(); const auto exponent = jwk.get_jwk_claim("e").as_string(); auto verifier = jwt::verify() diff --git a/example/partial-claim-verifier.cpp b/example/partial-claim-verifier.cpp index 737768c1..10e35376 100644 --- a/example/partial-claim-verifier.cpp +++ b/example/partial-claim-verifier.cpp @@ -44,7 +44,7 @@ rK0/Ikt5ybqUzKCMJZg2VKGTxg== .set_payload_claim("resource-access", role_claim) .sign(jwt::algorithm::rs256("", rsa_priv_key, "", "")); - std::cout << "token: " << token << std::endl; + std::cout << "token: " << token << '\n'; std::string rsa_pub_key = R"(-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuGbXWiK3dQTyCbX5xdE4 @@ -59,9 +59,9 @@ YwIDAQAB auto decoded = jwt::decode(token); for (const auto& e : decoded.get_payload_json()) - std::cout << e.first << " = " << e.second << std::endl; + std::cout << e.first << " = " << e.second << '\n'; - std::cout << std::endl; + std::cout << '\n'; auto role_verifier = [](const jwt::verify_context& ctx, std::error_code& ec) { using error = jwt::error::token_verification_error; @@ -88,8 +88,8 @@ YwIDAQAB try { verifier.verify(decoded); - std::cout << "Success!" << std::endl; - } catch (const std::exception& ex) { std::cout << "Error: " << ex.what() << std::endl; } + std::cout << "Success!" << '\n'; + } catch (const std::exception& ex) { std::cout << "Error: " << ex.what() << '\n'; } return 0; } diff --git a/example/print-claims.cpp b/example/print-claims.cpp index 156e3340..85032bb3 100644 --- a/example/print-claims.cpp +++ b/example/print-claims.cpp @@ -8,5 +8,5 @@ int main() { auto decoded = jwt::decode(token); for (auto& e : decoded.get_payload_json()) - std::cout << e.first << " = " << e.second << std::endl; + std::cout << e.first << " = " << e.second << '\n'; } diff --git a/example/private-claims.cpp b/example/private-claims.cpp index cd4375c3..f2718989 100644 --- a/example/private-claims.cpp +++ b/example/private-claims.cpp @@ -34,7 +34,7 @@ int main() { const auto decoded = jwt::decode(token); const auto api_array = decoded.get_payload_claim("object").to_json().get("api").get("array"); - std::cout << "api array = " << api_array << std::endl; + std::cout << "api array = " << api_array << '\n'; /* [verify exact claim] */ jwt::verify() diff --git a/example/rsa-create.cpp b/example/rsa-create.cpp index de9f05ce..eb14d092 100644 --- a/example/rsa-create.cpp +++ b/example/rsa-create.cpp @@ -41,5 +41,5 @@ rK0/Ikt5ybqUzKCMJZg2VKGTxg== .set_payload_claim("sample", jwt::claim(std::string{"test"})) .sign(jwt::algorithm::rs256("", rsa_priv_key, "", "")); - std::cout << "token:\n" << token << std::endl; + std::cout << "token:\n" << token << '\n'; } diff --git a/example/rsa-verify.cpp b/example/rsa-verify.cpp index 68e7d3be..36b393ff 100644 --- a/example/rsa-verify.cpp +++ b/example/rsa-verify.cpp @@ -35,7 +35,7 @@ YwIDAQAB verify.verify(decoded); for (auto& e : decoded.get_header_json()) - std::cout << e.first << " = " << e.second << std::endl; + std::cout << e.first << " = " << e.second << '\n'; for (auto& e : decoded.get_payload_json()) - std::cout << e.first << " = " << e.second << std::endl; + std::cout << e.first << " = " << e.second << '\n'; } diff --git a/example/traits/boost-json.cpp b/example/traits/boost-json.cpp index 59c585ee..6f6399db 100644 --- a/example/traits/boost-json.cpp +++ b/example/traits/boost-json.cpp @@ -35,11 +35,11 @@ int main() { const auto decoded = jwt::decode(token); for (auto& e : decoded.get_header_json()) - std::cout << e.key() << " = " << e.value() << std::endl; + std::cout << e.key() << " = " << e.value() << '\n'; 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; + std::cout << "payload /object/api/array = " << array << '\n'; jwt::verify() .allow_algorithm(jwt::algorithm::none{}) diff --git a/example/traits/danielaparker-jsoncons.cpp b/example/traits/danielaparker-jsoncons.cpp index e218d0ed..61043deb 100644 --- a/example/traits/danielaparker-jsoncons.cpp +++ b/example/traits/danielaparker-jsoncons.cpp @@ -34,7 +34,7 @@ int main() { const auto decoded = jwt::decode(token); const auto array = traits::as_array(decoded.get_payload_claim("object").to_json()["api"]["array"]); - std::cout << "payload /object/api/array = " << jsoncons::pretty_print(traits::json(array)) << std::endl; + std::cout << "payload /object/api/array = " << jsoncons::pretty_print(traits::json(array)) << '\n'; jwt::verify() .allow_algorithm(jwt::algorithm::none{}) diff --git a/example/traits/kazuho-picojson.cpp b/example/traits/kazuho-picojson.cpp index 16724007..4bdf4a07 100644 --- a/example/traits/kazuho-picojson.cpp +++ b/example/traits/kazuho-picojson.cpp @@ -34,7 +34,7 @@ int main() { const auto decoded = jwt::decode(token); const auto api_array = decoded.get_payload_claim("object").to_json().get("api").get("array"); - std::cout << "api array = " << api_array << std::endl; + std::cout << "api array = " << api_array << '\n'; jwt::verify() .allow_algorithm(jwt::algorithm::none{}) diff --git a/example/traits/nlohmann-json.cpp b/example/traits/nlohmann-json.cpp index 00fa2acd..f0bb1d5d 100644 --- a/example/traits/nlohmann-json.cpp +++ b/example/traits/nlohmann-json.cpp @@ -34,7 +34,7 @@ int main() { const auto decoded = jwt::decode(token); const auto array = traits::as_array(decoded.get_payload_claim("object").to_json()["api"]["array"]); - std::cout << "payload /object/api/array = " << array << std::endl; + std::cout << "payload /object/api/array = " << array << '\n'; jwt::verify() .allow_algorithm(jwt::algorithm::none{}) diff --git a/example/traits/open-source-parsers-jsoncpp.cpp b/example/traits/open-source-parsers-jsoncpp.cpp index 89366911..523925c1 100644 --- a/example/traits/open-source-parsers-jsoncpp.cpp +++ b/example/traits/open-source-parsers-jsoncpp.cpp @@ -34,7 +34,7 @@ int main() { const auto decoded = jwt::decode(token); const auto array = traits::as_array(decoded.get_payload_claim("object").to_json()["api"]["array"]); - std::cout << "payload /object/api/array = " << array << std::endl; + std::cout << "payload /object/api/array = " << array << '\n'; jwt::verify() .allow_algorithm(jwt::algorithm::none{}) diff --git a/include/jwt-cpp/jwt.h b/include/jwt-cpp/jwt.h index 2f59e4a9..f5136590 100644 --- a/include/jwt-cpp/jwt.h +++ b/include/jwt-cpp/jwt.h @@ -1819,7 +1819,7 @@ namespace jwt { ERR_clear_error(); if (EVP_DigestSignUpdate(ctx.get(), reinterpret_cast(data.data()), data.size()) != 1) { - std::cout << ERR_error_string(ERR_get_error(), NULL) << std::endl; + std::cout << ERR_error_string(ERR_get_error(), NULL) << '\n'; ec = error::signature_generation_error::signupdate_failed; return {}; } From cab487c6de4e0f2f919bf2f68a060573c97bf8a0 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 12:02:25 -0400 Subject: [PATCH 03/12] misc-const-correctness https://clang.llvm.org/extra/clang-tidy/checks/misc/const-correctness.html --- example/partial-claim-verifier.cpp | 4 ++-- example/rsa-create.cpp | 2 +- example/rsa-verify.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/partial-claim-verifier.cpp b/example/partial-claim-verifier.cpp index 10e35376..0ca427b1 100644 --- a/example/partial-claim-verifier.cpp +++ b/example/partial-claim-verifier.cpp @@ -4,7 +4,7 @@ #include int main() { - std::string rsa_priv_key = R"(-----BEGIN PRIVATE KEY----- + std::string const rsa_priv_key = R"(-----BEGIN PRIVATE KEY----- MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC4ZtdaIrd1BPIJ tfnF0TjIK5inQAXZ3XlCrUlJdP+XHwIRxdv1FsN12XyMYO/6ymLmo9ryoQeIrsXB XYqlET3zfAY+diwCb0HEsVvhisthwMU4gZQu6TYW2s9LnXZB5rVtcBK69hcSlA2k @@ -46,7 +46,7 @@ rK0/Ikt5ybqUzKCMJZg2VKGTxg== std::cout << "token: " << token << '\n'; - std::string rsa_pub_key = R"(-----BEGIN PUBLIC KEY----- + std::string const rsa_pub_key = R"(-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuGbXWiK3dQTyCbX5xdE4 yCuYp0AF2d15Qq1JSXT/lx8CEcXb9RbDddl8jGDv+spi5qPa8qEHiK7FwV2KpRE9 83wGPnYsAm9BxLFb4YrLYcDFOIGULuk2FtrPS512Qea1bXASuvYXEpQNpGbnTGVs diff --git a/example/rsa-create.cpp b/example/rsa-create.cpp index eb14d092..2243f268 100644 --- a/example/rsa-create.cpp +++ b/example/rsa-create.cpp @@ -3,7 +3,7 @@ #include int main() { - std::string rsa_priv_key = R"(-----BEGIN PRIVATE KEY----- + std::string const rsa_priv_key = R"(-----BEGIN PRIVATE KEY----- MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC4ZtdaIrd1BPIJ tfnF0TjIK5inQAXZ3XlCrUlJdP+XHwIRxdv1FsN12XyMYO/6ymLmo9ryoQeIrsXB XYqlET3zfAY+diwCb0HEsVvhisthwMU4gZQu6TYW2s9LnXZB5rVtcBK69hcSlA2k diff --git a/example/rsa-verify.cpp b/example/rsa-verify.cpp index 36b393ff..86ed54d5 100644 --- a/example/rsa-verify.cpp +++ b/example/rsa-verify.cpp @@ -3,7 +3,7 @@ #include int main() { - std::string rsa_pub_key = R"(-----BEGIN PUBLIC KEY----- + std::string const rsa_pub_key = R"(-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuGbXWiK3dQTyCbX5xdE4 yCuYp0AF2d15Qq1JSXT/lx8CEcXb9RbDddl8jGDv+spi5qPa8qEHiK7FwV2KpRE9 83wGPnYsAm9BxLFb4YrLYcDFOIGULuk2FtrPS512Qea1bXASuvYXEpQNpGbnTGVs From 677e712441f9f5d25b88049c113dd1360186ec76 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 12:08:33 -0400 Subject: [PATCH 04/12] misc-const-correctness https://clang.llvm.org/extra/clang-tidy/checks/misc/const-correctness.html --- README.md | 2 +- example/print-claims.cpp | 2 +- example/rsa-verify.cpp | 2 +- tests/ClaimTest.cpp | 4 ++-- tests/OpenSSLErrorTest.cpp | 2 +- tests/TokenFormatTest.cpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0ed3d2eb..6412ada0 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ A simple example is decoding a token and printing all of its [claims](https://to #include int main() { - std::string token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCIsInNhbXBsZSI6InRlc3QifQ.lQm3N2bVlqt2-1L-FsOjtR6uE-L4E9zJutMWKIe1v1M"; + std::string const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCIsInNhbXBsZSI6InRlc3QifQ.lQm3N2bVlqt2-1L-FsOjtR6uE-L4E9zJutMWKIe1v1M"; auto decoded = jwt::decode(token); for(auto& e : decoded.get_payload_json()) diff --git a/example/print-claims.cpp b/example/print-claims.cpp index 85032bb3..d7ba0dc3 100644 --- a/example/print-claims.cpp +++ b/example/print-claims.cpp @@ -3,7 +3,7 @@ #include int main() { - std::string token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCIsInNhbXBsZSI6InRlc3QifQ.lQm3N2bVlqt2-" + std::string const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCIsInNhbXBsZSI6InRlc3QifQ.lQm3N2bVlqt2-" "1L-FsOjtR6uE-L4E9zJutMWKIe1v1M"; auto decoded = jwt::decode(token); diff --git a/example/rsa-verify.cpp b/example/rsa-verify.cpp index 86ed54d5..3c11a293 100644 --- a/example/rsa-verify.cpp +++ b/example/rsa-verify.cpp @@ -13,7 +13,7 @@ AziMCxS+VrRPDM+zfvpIJg3JljAh3PJHDiLu902v9w+Iplu1WyoB2aPfitxEhRN0 YwIDAQAB -----END PUBLIC KEY-----)"; - std::string token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9." + std::string const token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9." "VA2i1ui1cnoD6I3wnji1WAVCf29EekysvevGrT2GXqK1dDMc8" "HAZCTQxa1Q8NppnpYV-hlqxh-X3Bb0JOePTGzjynpNZoJh2aHZD-" "GKpZt7OO1Zp8AFWPZ3p8Cahq8536fD8RiBES9jRsvChZvOqA7gMcFc4" diff --git a/tests/ClaimTest.cpp b/tests/ClaimTest.cpp index e7cccc3b..cd780674 100644 --- a/tests/ClaimTest.cpp +++ b/tests/ClaimTest.cpp @@ -2,7 +2,7 @@ #include TEST(ClaimTest, AudienceAsString) { - std::string token = + std::string const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ0ZXN0In0.WZnM3SIiSRHsbO3O7Z2bmIzTJ4EC32HRBKfLznHhrh4"; auto decoded = jwt::decode(token); @@ -32,7 +32,7 @@ TEST(ClaimTest, SetAudienceAsString) { } TEST(ClaimTest, AudienceAsSet) { - std::string token = "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJhdWQiOlsidGVzdCIsInRlc3QyIl19."; + std::string const token = "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJhdWQiOlsidGVzdCIsInRlc3QyIl19."; auto decoded = jwt::decode(token); ASSERT_TRUE(decoded.has_algorithm()); diff --git a/tests/OpenSSLErrorTest.cpp b/tests/OpenSSLErrorTest.cpp index 467ae6f7..71440b38 100644 --- a/tests/OpenSSLErrorTest.cpp +++ b/tests/OpenSSLErrorTest.cpp @@ -1084,7 +1084,7 @@ TEST(OpenSSLErrorTest, LoadPrivateKeyFromStringErrorCode) { #if !defined(LIBWOLFSSL_VERSION_HEX) || LIBWOLFSSL_VERSION_HEX > 0x05007000 TEST(OpenSSLErrorTest, HMACSign) { - std::string token = + std::string const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9.AbIJTDMFc7yUa5MhvcP03nJPyCPzZtQcGEp-zWfOkEE"; auto verify = jwt::verify().allow_algorithm(jwt::algorithm::hs256{"secret"}).with_issuer("auth0"); diff --git a/tests/TokenFormatTest.cpp b/tests/TokenFormatTest.cpp index ce06ea09..2925b065 100644 --- a/tests/TokenFormatTest.cpp +++ b/tests/TokenFormatTest.cpp @@ -18,7 +18,7 @@ TEST(TokenFormatTest, InvalidJSON) { #include "jwt-cpp/traits/nlohmann-json/traits.h" TEST(TokenFormatTest, GitHubIssue341) { - std::string token = + std::string const token = "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjYXV0aDAiLCJleHAiOjE3MTMzODgxNjgsInN1YiI6InRlc3RfdXNlciJ9." "dlAk0mSWk1Clzfi1PMq7Omxun3EyEqh-AAu-fTkpabA67ZKenawAQhZO8glY93flukpJCqHLVtukaes6ZSOjGw"; auto decoded = jwt::decoded_jwt(token); From f6b671572893e24d6ff2ef6d6f865abf449b5f84 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 12:14:50 -0400 Subject: [PATCH 05/12] formatting --- example/print-claims.cpp | 3 ++- example/rsa-verify.cpp | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/example/print-claims.cpp b/example/print-claims.cpp index d7ba0dc3..a98fdc05 100644 --- a/example/print-claims.cpp +++ b/example/print-claims.cpp @@ -3,7 +3,8 @@ #include int main() { - std::string const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCIsInNhbXBsZSI6InRlc3QifQ.lQm3N2bVlqt2-" + const std::string token = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCIsInNhbXBsZSI6InRlc3QifQ.lQm3N2bVlqt2-" "1L-FsOjtR6uE-L4E9zJutMWKIe1v1M"; auto decoded = jwt::decode(token); diff --git a/example/rsa-verify.cpp b/example/rsa-verify.cpp index 3c11a293..c8240b49 100644 --- a/example/rsa-verify.cpp +++ b/example/rsa-verify.cpp @@ -3,7 +3,7 @@ #include int main() { - std::string const rsa_pub_key = R"(-----BEGIN PUBLIC KEY----- + const std::string rsa_pub_key = R"(-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuGbXWiK3dQTyCbX5xdE4 yCuYp0AF2d15Qq1JSXT/lx8CEcXb9RbDddl8jGDv+spi5qPa8qEHiK7FwV2KpRE9 83wGPnYsAm9BxLFb4YrLYcDFOIGULuk2FtrPS512Qea1bXASuvYXEpQNpGbnTGVs @@ -13,14 +13,14 @@ AziMCxS+VrRPDM+zfvpIJg3JljAh3PJHDiLu902v9w+Iplu1WyoB2aPfitxEhRN0 YwIDAQAB -----END PUBLIC KEY-----)"; - std::string const token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9." - "VA2i1ui1cnoD6I3wnji1WAVCf29EekysvevGrT2GXqK1dDMc8" - "HAZCTQxa1Q8NppnpYV-hlqxh-X3Bb0JOePTGzjynpNZoJh2aHZD-" - "GKpZt7OO1Zp8AFWPZ3p8Cahq8536fD8RiBES9jRsvChZvOqA7gMcFc4" - "YD0iZhNIcI7a654u5yPYyTlf5kjR97prCf_OXWRn-bYY74zna4p_bP9oWCL4BkaoRcMxi-" - "IR7kmVcCnvbYqyIrKloXP2qPO442RBGqU7Ov9" - "sGQxiVqtRHKXZR9RbfvjrErY1KGiCp9M5i2bsUHadZEY44FE2jiOmx-" - "uc2z5c05CCXqVSpfCjWbh9gQ"; + const std::string token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9." + "VA2i1ui1cnoD6I3wnji1WAVCf29EekysvevGrT2GXqK1dDMc8" + "HAZCTQxa1Q8NppnpYV-hlqxh-X3Bb0JOePTGzjynpNZoJh2aHZD-" + "GKpZt7OO1Zp8AFWPZ3p8Cahq8536fD8RiBES9jRsvChZvOqA7gMcFc4" + "YD0iZhNIcI7a654u5yPYyTlf5kjR97prCf_OXWRn-bYY74zna4p_bP9oWCL4BkaoRcMxi-" + "IR7kmVcCnvbYqyIrKloXP2qPO442RBGqU7Ov9" + "sGQxiVqtRHKXZR9RbfvjrErY1KGiCp9M5i2bsUHadZEY44FE2jiOmx-" + "uc2z5c05CCXqVSpfCjWbh9gQ"; /* [allow rsa algorithm] */ auto verify = jwt::verify() From a779cf20fff1805ac731f50887d8b7b88a228c60 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 12:23:41 -0400 Subject: [PATCH 06/12] clang format and tidy and already installed https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#language-and-runtime --- .github/workflows/lint.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0c57e8ac..9bf025e2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,11 +20,9 @@ jobs: - "example/*.cpp" - "example/**/*.cpp" steps: - - run: | - sudo apt-get install clang-format-14 - shopt -s globstar + - run: shopt -s globstar - uses: actions/checkout@v4 - - run: clang-format-14 -i ${{ matrix.files }} + - run: clang-format -i ${{ matrix.files }} - uses: ./.github/actions/process-linting-results with: linter_name: clang-format @@ -50,7 +48,6 @@ jobs: clang-tidy: runs-on: ubuntu-latest steps: - - run: sudo apt-get install clang-tidy - uses: lukka/get-cmake@latest - uses: actions/checkout@v4 - name: configure From f240701205922757c08a918c0c717070eb4661a7 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 12:25:19 -0400 Subject: [PATCH 07/12] explict clang-format-14 --- .github/workflows/lint.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9bf025e2..1e4066ad 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,9 +20,11 @@ jobs: - "example/*.cpp" - "example/**/*.cpp" steps: - - run: shopt -s globstar + - run: | + sudo apt-get install clang-format-14 + shopt -s globstar - uses: actions/checkout@v4 - - run: clang-format -i ${{ matrix.files }} + - run: clang-format-14 -i ${{ matrix.files }} - uses: ./.github/actions/process-linting-results with: linter_name: clang-format From d24edf2eac781f7b7bdbbd964ddc491652eb61c6 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 12:30:01 -0400 Subject: [PATCH 08/12] disable include cleaner --- .clang-tidy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index e35b6151..b8147418 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -20,7 +20,8 @@ Checks: '-*, readability-*, -readability-magic-numbers, -readability-braces-around-statements, - -readability-uppercase-literal-suffix' + -readability-uppercase-literal-suffix, + -misc-include-cleaner' CheckOptions: - key: readability-identifier-naming.TypedefCase From d7054df0a5870221cbd328268828a846bc4b1777 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 15:13:01 -0400 Subject: [PATCH 09/12] format --- example/print-claims.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/print-claims.cpp b/example/print-claims.cpp index a98fdc05..81b331c9 100644 --- a/example/print-claims.cpp +++ b/example/print-claims.cpp @@ -4,8 +4,8 @@ int main() { const std::string token = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCIsInNhbXBsZSI6InRlc3QifQ.lQm3N2bVlqt2-" - "1L-FsOjtR6uE-L4E9zJutMWKIe1v1M"; + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCIsInNhbXBsZSI6InRlc3QifQ.lQm3N2bVlqt2-" + "1L-FsOjtR6uE-L4E9zJutMWKIe1v1M"; auto decoded = jwt::decode(token); for (auto& e : decoded.get_payload_json()) From b0c5ee3e6aeed46a632c23b67745b97ec1f85267 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 15:22:12 -0400 Subject: [PATCH 10/12] format --- example/print-claims.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/print-claims.cpp b/example/print-claims.cpp index 81b331c9..15badcc9 100644 --- a/example/print-claims.cpp +++ b/example/print-claims.cpp @@ -3,7 +3,7 @@ #include int main() { - const std::string token = + const std::string token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCIsInNhbXBsZSI6InRlc3QifQ.lQm3N2bVlqt2-" "1L-FsOjtR6uE-L4E9zJutMWKIe1v1M"; auto decoded = jwt::decode(token); From 8c8369361a2e80d08a156bed2f3aface9aa225b2 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 15:31:35 -0400 Subject: [PATCH 11/12] install lcov to get patching geninfo for gcc 13 --- .github/workflows/jwt.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/jwt.yml b/.github/workflows/jwt.yml index 46eed971..c3762bc2 100644 --- a/.github/workflows/jwt.yml +++ b/.github/workflows/jwt.yml @@ -10,6 +10,7 @@ jobs: coverage: runs-on: ubuntu-latest steps: + - run: sudo apt install lcov - uses: actions/checkout@v4 - uses: lukka/get-cmake@latest - uses: ./.github/actions/install/gtest From 41d9ca1980135c7b58052a6c01bb89c111830140 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 13 May 2025 17:19:43 -0400 Subject: [PATCH 12/12] revert "install lcov to get patching geninfo for gcc 13" --- .github/workflows/jwt.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/jwt.yml b/.github/workflows/jwt.yml index c3762bc2..46eed971 100644 --- a/.github/workflows/jwt.yml +++ b/.github/workflows/jwt.yml @@ -10,7 +10,6 @@ jobs: coverage: runs-on: ubuntu-latest steps: - - run: sudo apt install lcov - uses: actions/checkout@v4 - uses: lukka/get-cmake@latest - uses: ./.github/actions/install/gtest