|
Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
|
Classes | |
| struct | SigningKey |
The key a token is signed with. Set exactly one of secret and private_key_pem. More... | |
| struct | SignOptions |
| Registered claims sign() adds. Claims already present in the payload win. More... | |
Functions | |
| std::string | sign (nlohmann::json claims, const SigningKey &key, const SignOptions &options={}) |
| Issues a signed JWT (JWS compact serialisation) that jwt_auth() with the matching secret or public key accepts. | |
| template<typename T > | |
| std::optional< T > | claim (const nlohmann::json &claims, const std::string &name) |
A claim from verified claims (req.user), if present with that type: jwt::claim<std::string>(req.user, "sub"), claim<int64_t>(req.user, "exp"). | |
| std::optional< T > orbit::jwt::claim | ( | const nlohmann::json & | claims, |
| const std::string & | name | ||
| ) |
A claim from verified claims (req.user), if present with that type: jwt::claim<std::string>(req.user, "sub"), claim<int64_t>(req.user, "exp").
| std::string orbit::jwt::sign | ( | nlohmann::json | claims, |
| const SigningKey & | key, | ||
| const SignOptions & | options = {} |
||
| ) |
Issues a signed JWT (JWS compact serialisation) that jwt_auth() with the matching secret or public key accepts.
"iat" is set to the current time unless claims has one; see SignOptions for the others. claims may be null ({}) for none.
| std::invalid_argument | if claims is not an object, or the key is missing, ambiguous or unusable. |