Skip to content

Commit 0b1191d

Browse files
committed
Merge branch 'master' into is-12
2 parents cb6aec7 + d1ee2ca commit 0b1191d

File tree

9 files changed

+40
-173
lines changed

9 files changed

+40
-173
lines changed

Development/cmake/NmosCppTest.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ target_link_libraries(
126126
nmos-cpp::mdns
127127
nmos-cpp::cpprestsdk
128128
nmos-cpp::Boost
129-
nmos-cpp::jwt-cpp
129+
nmos-cpp::jwt-cpp
130130
)
131131
if(NMOS_CPP_BUILD_LLDP)
132132
target_link_libraries(

Development/conanfile.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
boost/1.83.0
33
cpprestsdk/2.10.19
44
websocketpp/0.8.2
5-
openssl/1.1.1s
5+
openssl/3.2.1
66
json-schema-validator/2.3.0
77
nlohmann_json/3.11.3
88
zlib/1.2.13

Development/jwk/algorithm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace jwk
88
DEFINE_STRING_ENUM(algorithm)
99
namespace algorithms
1010
{
11-
// RS256/RS384/RS512
11+
// RS256/RS384/RS512
1212
const algorithm RS256{ U("RS256") };
1313
const algorithm RS384{ U("RS384") };
1414
const algorithm RS512{ U("RS512") };

Development/nmos/api_utils.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ namespace nmos
5353
const route_pattern connection_api = make_route_pattern(U("api"), U("connection"));
5454
// IS-07 Events API
5555
const route_pattern events_api = make_route_pattern(U("api"), U("events"));
56-
// IS-08 Channel Mapping API
57-
const route_pattern channelmapping_api = make_route_pattern(U("api"), U("channelmapping"));
56+
// IS-08 Channel Mapping API
57+
const route_pattern channelmapping_api = make_route_pattern(U("api"), U("channelmapping"));
5858
// IS-09 System API (originally specified in JT-NM TR-1001-1:2018 Annex A)
5959
const route_pattern system_api = make_route_pattern(U("api"), U("system"));
6060

Development/nmos/ws_api_utils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ namespace nmos
5656
return true;
5757
};
5858
}
59-
}
59+
}
6060
}

Development/third_party/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Third-party source files used by the nmos-cpp libraries
77
- [cmake](cmake)
88
CMake modules derived from third-party sources
99
- [jwt-cpp](jwt-cpp)
10-
The [C++ JSON Web Tokens creator and validator] (https://github.com/Thalhammer/jwt-cpp) header only library
10+
The [Thalhammer/jwt-cpp](https://github.com/Thalhammer/jwt-cpp) header only library for creating and validating JSON Web Tokens in C++11
1111
- [mDNSResponder](mDNSResponder)
1212
Patches and patched source files for the Bonjour DNS-SD implementation
1313
- [nlohmann](nlohmann)
+5-152
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,8 @@
1-
<img src="https://raw.githubusercontent.com/Thalhammer/jwt-cpp/master/.github/logo.svg" alt="logo" width="100%">
1+
# jwt-cpp
22

3-
[![License Badge](https://img.shields.io/github/license/Thalhammer/jwt-cpp)](https://github.com/Thalhammer/jwt-cpp/blob/master/LICENSE)
4-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5f7055e294744901991fd0a1620b231d)](https://app.codacy.com/gh/Thalhammer/jwt-cpp/dashboard)
5-
[![Linux Badge][Linux]][Cross-Platform]
6-
[![MacOS Badge][MacOS]][Cross-Platform]
7-
[![Windows Badge][Windows]][Cross-Platform]
8-
[![Coverage Status](https://coveralls.io/repos/github/Thalhammer/jwt-cpp/badge.svg?branch=master)](https://coveralls.io/github/Thalhammer/jwt-cpp?branch=master)
3+
This directory contains files from the [Thalhammer/jwt-cpp](https://github.com/Thalhammer/jwt-cpp) header only library for creating and validating JSON Web Tokens in C++11.
94

10-
[![Documentation Badge](https://img.shields.io/badge/Documentation-master-blue)](https://thalhammer.github.io/jwt-cpp/)
5+
Original source code:
116

12-
[![Stars Badge](https://img.shields.io/github/stars/Thalhammer/jwt-cpp)](https://github.com/Thalhammer/jwt-cpp/stargazers)
13-
[![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/Thalhammer/jwt-cpp?include_prereleases)](https://github.com/Thalhammer/jwt-cpp/releases)
14-
[![ConanCenter package](https://repology.org/badge/version-for-repo/conancenter/jwt-cpp.svg)](https://repology.org/project/jwt-cpp/versions)
15-
[![Vcpkg package](https://repology.org/badge/version-for-repo/vcpkg/jwt-cpp.svg)](https://repology.org/project/jwt-cpp/versions)
16-
17-
[Linux]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/cross-platform/ubuntu-latest/shields.json
18-
[MacOS]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/cross-platform/macos-latest/shields.json
19-
[Windows]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/cross-platform/windows-latest/shields.json
20-
[Cross-Platform]: https://github.com/Thalhammer/jwt-cpp/actions?query=workflow%3A%22Cross-Platform+CI%22
21-
22-
A header only library for creating and validating [JSON Web Tokens](https://tools.ietf.org/html/rfc7519) in C++11. For a great introduction, [read this](https://jwt.io/introduction/).
23-
24-
## Signature algorithms
25-
26-
jwt-cpp supports all the algorithms defined by the specifications. The modular design allows to easily add additional algorithms without any problems. If you need any feel free to create a pull request or [open an issue](https://github.com/Thalhammer/jwt-cpp/issues/new).
27-
28-
For completeness, here is a list of all supported algorithms:
29-
30-
| HMSC | RSA | ECDSA | PSS | EdDSA |
31-
|-------|-------|--------|-------|---------|
32-
| HS256 | RS256 | ES256 | PS256 | Ed25519 |
33-
| HS384 | RS384 | ES384 | PS384 | Ed448 |
34-
| HS512 | RS512 | ES512 | PS512 | |
35-
| | | ES256K | | |
36-
37-
## SSL Compatibility
38-
39-
In the name of flexibility and extensibility, jwt-cpp supports [OpenSSL](https://github.com/openssl/openssl), [LibreSSL](https://github.com/libressl-portable/portable), and [wolfSSL](https://github.com/wolfSSL/wolfssl). Read [this page](docs/ssl.md) for more details. These are the version which are currently being tested:
40-
41-
| OpenSSL | LibreSSL | wolfSSL |
42-
|-------------------|----------------|----------------|
43-
| ![1.0.2u][o1.0.2] | ![3.3.6][l3.3] | ![5.1.1][w5.1] |
44-
| ![1.1.0i][o1.1.0] | ![3.4.3][l3.4] | ![5.2.0][w5.2] |
45-
| ![1.1.1q][o1.1.1] | ![3.5.3][l3.5] | ![5.3.0][w5.3] |
46-
| ![3.0.5][o3.0] | | |
47-
48-
> ℹ️ Note: A complete list of versions tested in the past can be found [here](https://github.com/Thalhammer/jwt-cpp/tree/badges).
49-
50-
[o1.0.2]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/1.0.2u/shields.json
51-
[o1.1.0]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/1.1.0i/shields.json
52-
[o1.1.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/1.1.1q/shields.json
53-
[o3.0]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.0.5/shields.json
54-
[l3.3]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/3.3.6/shields.json
55-
[l3.4]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/3.4.3/shields.json
56-
[l3.5]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/3.5.3/shields.json
57-
[w5.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.1.1/shields.json
58-
[w5.2]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.2.0/shields.json
59-
[w5.3]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.3.0/shields.json
60-
61-
## Overview
62-
63-
There is no hard dependency on a JSON library. Instead, there's a generic `jwt::basic_claim` which is templated around type traits, which described the semantic [JSON types](https://json-schema.org/understanding-json-schema/reference/type.html) for a value, object, array, string, number, integer and boolean, as well as methods to translate between them.
64-
65-
```cpp
66-
jwt::basic_claim<my_favorite_json_library_traits> claim(json::object({{"json", true},{"example", 0}}));
67-
```
68-
69-
This allows for complete freedom when picking which libraries you want to use. For more information, [read this page](docs/traits.md)).
70-
71-
For your convenience there are serval traits implementation which provide some popular JSON libraries. They are:
72-
73-
[![picojson][picojson]](https://github.com/kazuho/picojson)
74-
[![nlohmann][nlohmann]](https://github.com/nlohmann/json)
75-
[![jsoncons][jsoncons]](https://github.com/danielaparker/jsoncons)
76-
[![boostjson][boostjson]](https://github.com/boostorg/json)
77-
78-
[picojson]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/traits/kazuho-picojson/shields.json
79-
[nlohmann]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/traits/nlohmann-json/shields.json
80-
[jsoncons]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/traits/danielaparker-jsoncons/shields.json
81-
[boostjson]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/traits/boost-json/shields.json
82-
83-
In order to maintain compatibility, [picojson](https://github.com/kazuho/picojson) is still used to provide a specialized `jwt::claim` along with all helpers. Defining `JWT_DISABLE_PICOJSON` will remove this optional dependency. It's possible to directly include the traits defaults for the other JSON libraries. See the [traits examples](https://github.com/Thalhammer/jwt-cpp/tree/master/example/traits) for details.
84-
85-
As for the base64 requirements of JWTs, this library provides `base.h` with all the required implementation; However base64 implementations are very common, with varying degrees of performance. When providing your own base64 implementation, you can define `JWT_DISABLE_BASE64` to remove the jwt-cpp implementation.
86-
87-
### Getting Started
88-
89-
Simple example of decoding a token and printing all [claims](https://tools.ietf.org/html/rfc7519#section-4) ([try it out](https://github.com/Thalhammer/jwt-cpp/tree/master/example/print-claims.cpp)):
90-
91-
```cpp
92-
#include <jwt-cpp/jwt.h>
93-
#include <iostream>
94-
95-
int main() {
96-
std::string token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9.AbIJTDMFc7yUa5MhvcP03nJPyCPzZtQcGEp-zWfOkEE";
97-
auto decoded = jwt::decode(token);
98-
99-
for(auto& e : decoded.get_payload_json())
100-
std::cout << e.first << " = " << e.second << std::endl;
101-
}
102-
```
103-
104-
In order to verify a token you first build a verifier and use it to verify a decoded token.
105-
106-
```cpp
107-
auto verifier = jwt::verify()
108-
.allow_algorithm(jwt::algorithm::hs256{ "secret" })
109-
.with_issuer("auth0");
110-
111-
verifier.verify(decoded_token);
112-
```
113-
114-
The created verifier is stateless so you can reuse it for different tokens.
115-
116-
Creating a token (and signing) is equally as easy.
117-
118-
```cpp
119-
auto token = jwt::create()
120-
.set_issuer("auth0")
121-
.set_type("JWS")
122-
.set_payload_claim("sample", jwt::claim(std::string("test")))
123-
.sign(jwt::algorithm::hs256{"secret"});
124-
```
125-
126-
> To see more examples working with RSA public and private keys, visit our [examples](https://github.com/Thalhammer/jwt-cpp/tree/master/example)!
127-
128-
### Providing your own JSON Traits
129-
130-
To learn how to writes a trait's implementation, checkout the [these instructions](docs/traits.md)
131-
132-
## Contributing
133-
134-
If you have an improvement or found a bug feel free to [open an issue](https://github.com/Thalhammer/jwt-cpp/issues/new) or add the change and create a pull request. If you file a bug please make sure to include as much information about your environment (compiler version, etc.) as possible to help reproduce the issue. If you add a new feature please make sure to also include test cases for it.
135-
136-
## Dependencies
137-
138-
In order to use jwt-cpp you need the following tools.
139-
140-
* libcrypto (openssl or compatible)
141-
* libssl-dev (for the header files)
142-
* a compiler supporting at least c++11
143-
* basic stl support
144-
145-
In order to build the test cases you also need
146-
147-
* gtest
148-
* pthread
149-
150-
## Troubleshooting
151-
152-
See the [FAQs](docs/faqs.md) for tips.
153-
154-
## Conference Coverage
155-
[![CppCon](https://img.youtube.com/vi/Oq4NW5idmiI/0.jpg)](https://www.youtube.com/watch?v=Oq4NW5idmiI)
7+
- Licensed under the MIT License <http://opensource.org/licenses/MIT>.
8+
- Copyright (c) 2018 Dominik Thalhammer

Documents/Dependencies.md

+24-10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ More details are given below.
1212
- This library incorporates some third-party material including WebSocket++, and also relies on e.g. some of the Boost C++ Libraries and [OpenSSL](https://www.openssl.org/).
1313
- The [WebSocket++](https://github.com/zaphoyd/websocketpp) header-only C++ websocket client/server library, to implement Query API websocket subscriptions
1414
- For JSON Schema validation, the [Modern C++ JSON schema validator](https://github.com/pboettch/json-schema-validator) library, which is implemented on top of [JSON for Modern C++](https://github.com/nlohmann/json)
15+
- For creating and validating JSON Web Tokens, the [Thalhammer/jwt-cpp](https://github.com/Thalhammer/jwt-cpp) header only library
1516
- For DNS Service Discovery (DNS-SD), the [Bonjour SDK](https://developer.apple.com/bonjour/) on Windows, and on Linux either [Avahi](https://www.avahi.org/) or Apple's [mDNSResponder](https://opensource.apple.com/tarballs/mDNSResponder/) (another name for Bonjour)
1617
- The [Catch](https://github.com/philsquared/Catch) automated test framework, for unit testing
1718

@@ -54,7 +55,7 @@ By default nmos-cpp uses [Conan](https://conan.io) to download most of its depen
5455

5556
1. Install Python 3 if necessary
5657
Note: The Python scripts directory needs to be added to the `PATH`, so the Conan executable can be found
57-
2. Install or upgrade Conan using `pip install --upgrade conan~=1.47`
58+
2. Install or upgrade Conan using `pip install --upgrade conan~=1.47`
5859
Notes:
5960
- On some platforms with Python 2 and Python 3 both installed this may need to be `pip3 install --upgrade conan~=1.47`
6061
- Currently, Conan 1.47 or higher (and lower than version 2.0) is required by the nmos-cpp recipe; dependencies may require a higher version; version 1.59.0 has been tested
@@ -152,8 +153,8 @@ If using Conan, this section can be skipped.
152153
- Set ``Boost_USE_STATIC_LIBS`` (BOOL) to ``1`` (true)
153154
- If CMake cannot find it automatically, set hints for [finding Boost](https://cmake.org/cmake/help/latest/module/FindBoost.html), for example:
154155
- *Either* set ``Boost_DIR`` (PATH) to the location of the installed BoostConfig.cmake (since Boost 1.70.0)
155-
- *Or* set ``BOOST_INCLUDEDIR`` (PATH) and ``BOOST_LIBRARYDIR`` (PATH) to the appropriate full paths, e.g. *``<home-dir>``*``/boost_1_80_0``
156-
and *``<home-dir>``*``/boost_1_80_0/x64/lib`` respectively to match the suggested ``b2`` command
156+
- *Or* set ``BOOST_INCLUDEDIR`` (PATH) and ``BOOST_LIBRARYDIR`` (PATH) to the appropriate full paths, e.g. *``<home-dir>``*``/boost_1_83_0``
157+
and *``<home-dir>``*``/boost_1_83_0/x64/lib`` respectively to match the suggested ``b2`` command
157158
- Due to interactions with other dependencies, it may also be necessary to explicitly set ``WERROR`` (BOOL) to ``0`` so that compiler warnings are not treated as errors
158159
- To speed up the build by omitting the C++ REST SDK sample apps and test suite, set ``BUILD_SAMPLES`` and ``BUILD_TESTS`` (BOOL) to ``0`` (false)
159160
3. Use CMake to generate build/project files, and then build *and* install
@@ -172,8 +173,8 @@ cmake .. ^
172173
-DCPPREST_EXCLUDE_COMPRESSION:BOOL="1" ^
173174
-DCMAKE_CONFIGURATION_TYPES:STRING="Debug;Release" ^
174175
-DBoost_USE_STATIC_LIBS:BOOL="1" ^
175-
-DBOOST_INCLUDEDIR:PATH="<home-dir>/boost_1_80_0" ^
176-
-DBOOST_LIBRARYDIR:PATH="<home-dir>/boost_1_80_0/x64/lib" ^
176+
-DBOOST_INCLUDEDIR:PATH="<home-dir>/boost_1_83_0" ^
177+
-DBOOST_LIBRARYDIR:PATH="<home-dir>/boost_1_83_0/x64/lib" ^
177178
-DWERROR:BOOL="0" ^
178179
-DBUILD_SAMPLES:BOOL="0" ^
179180
-DBUILD_TESTS:BOOL="0"
@@ -234,15 +235,17 @@ If using Conan, this section can be skipped.
234235
<summary>If not using Conan...</summary>
235236

236237
The C++ REST SDK depends on [OpenSSL](https://www.openssl.org/) (to implement secure HTTP and/or secure WebSockets).
237-
It is compatible with the OpenSSL 1.1 API, so the 1.1.1 Long Term Support (LTS) release is recommended.
238-
It is also possible to use OpenSSL 1.0, but the OpenSSL team announced that [users of that release are strongly advised to upgrade to OpenSSL 1.1.1](https://www.openssl.org/blog/blog/2018/09/11/release111/).
238+
The nmos-cpp codebase also uses OpenSSL directly to implement the specific requirements of [AMWA BCP-003-01 Secure Communication in NMOS Systems](https://specs.amwa.tv/bcp-003-01/) and [AMWA BCP-003-02 Authorization in NMOS Systems](https://specs.amwa.tv/bcp-003-02/).
239239

240-
1. Download and install a recent release
240+
OpenSSL version 3 is recommended, and version 3.2.1 (latest release at the time) has been tested.
241+
It is currently also possible to use OpenSSL v1.1.1, although [this OpenSSL release is now end of life](https://www.openssl.org/blog/blog/2023/09/11/eol-111/index.html).
242+
243+
1. Download and install a recent release
241244
Notes:
242245
- On Windows, an installer can be downloaded from [Shining Light Productions - Win32 OpenSSL](https://slproweb.com/products/Win32OpenSSL.html)
243-
The Win64 OpenSSL v1.1.1s installer (latest release at the time) has been tested
246+
The Win64 OpenSSL v3.2.1 installer (latest release at the time) has been tested
244247
- On Linux distributions, an OpenSSL package may already be available
245-
The Ubuntu team announced an [OpenSSL 1.1.1 stable release update (SRU) for Ubuntu 18.04 LTS](https://lists.ubuntu.com/archives/ubuntu-devel/2018-December/040567.html)
248+
For example, Ubuntu 22.04 LTS includes OpenSSL v3.0.2
246249

247250
</details>
248251

@@ -257,6 +260,17 @@ No installation is necessary.
257260

258261
</details>
259262

263+
### jwt-cpp
264+
265+
If using Conan, this section can be skipped.
266+
<details>
267+
<summary>If not using Conan...</summary>
268+
269+
A copy of the source code necessary to use this library is included in the [third_party/jwt-cpp](../Development/third_party/jwt-cpp) directory.
270+
No installation is necessary.
271+
272+
</details>
273+
260274
### DNS Service Discovery
261275

262276
**Windows**

Documents/Getting-Started.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Notes:
3232

3333
- If CMake cannot find it automatically, set hints for [finding Boost](https://cmake.org/cmake/help/latest/module/FindBoost.html), for example:
3434
- *Either* set ``Boost_DIR`` (PATH) to the location of the installed *BoostConfig.cmake* (since Boost 1.70.0)
35-
- *Or* set ``BOOST_INCLUDEDIR`` (PATH) and ``BOOST_LIBRARYDIR`` (PATH) to the appropriate full paths, e.g. *``<home-dir>``*``/boost_1_80_0``
36-
and *``<home-dir>``*``/boost_1_80_0/x64/lib`` respectively to match the suggested ``b2`` command
35+
- *Or* set ``BOOST_INCLUDEDIR`` (PATH) and ``BOOST_LIBRARYDIR`` (PATH) to the appropriate full paths, e.g. *``<home-dir>``*``/boost_1_83_0``
36+
and *``<home-dir>``*``/boost_1_83_0/x64/lib`` respectively to match the suggested ``b2`` command
3737
- If CMake cannot find them automatically, set hints for finding the C++ REST SDK and WebSocket++, for example:
3838
- Set ``cpprestsdk_DIR`` (PATH) to the location of the installed *cpprestsdk-config.cmake*
3939
- *Either* set ``websocketpp_DIR`` (PATH) to the location of the installed *websocketpp-config.cmake*
@@ -75,8 +75,8 @@ cmake .. ^
7575
-G "Visual Studio 16 2019" ^
7676
-DCMAKE_CONFIGURATION_TYPES:STRING="Debug;Release" ^
7777
-DBoost_USE_STATIC_LIBS:BOOL="1" ^
78-
-DBOOST_INCLUDEDIR:PATH="<home-dir>/boost_1_80_0" ^
79-
-DBOOST_LIBRARYDIR:PATH="<home-dir>/boost_1_80_0/x64/lib" ^
78+
-DBOOST_INCLUDEDIR:PATH="<home-dir>/boost_1_83_0" ^
79+
-DBOOST_LIBRARYDIR:PATH="<home-dir>/boost_1_83_0/x64/lib" ^
8080
-DWEBSOCKETPP_INCLUDE_DIR:PATH="<home-dir>/cpprestsdk/Release/libs/websocketpp"
8181
```
8282

0 commit comments

Comments
 (0)