mirror of
https://github.com/allankoechke/jwt-cpp.git
synced 2026-11-30 10:18:40 +00:00
🧰 Linting and maintenance (#120)
* some manual fixes to obtain * fairly close enough * whitespace fixes * add comment * adding clang format + applied * add editorconfig (supported natively by github web editor) * apply linting to project * clean up CI workflows * zap vcpkg folder actual one is here https://github.com/microsoft/vcpkg/tree/master/ports/jwt-cpp * adding a logo * thin the lines in the pluses * use logo + more links to spec and examples * Create lint.yml * apply linting
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include <iostream>
|
||||
#include <jwt-cpp/jwt.h>
|
||||
|
||||
int main(int argc, const char **argv) {
|
||||
std::string rsa_priv_key = R"(-----BEGIN PRIVATE KEY-----
|
||||
int main(int argc, const char** argv) {
|
||||
std::string rsa_priv_key = R"(-----BEGIN PRIVATE KEY-----
|
||||
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC4ZtdaIrd1BPIJ
|
||||
tfnF0TjIK5inQAXZ3XlCrUlJdP+XHwIRxdv1FsN12XyMYO/6ymLmo9ryoQeIrsXB
|
||||
XYqlET3zfAY+diwCb0HEsVvhisthwMU4gZQu6TYW2s9LnXZB5rVtcBK69hcSlA2k
|
||||
@@ -30,7 +30,7 @@ RultUEe2C0jYMDQx+JYxbPmtcopvZQrFEur3WKVuLy5UAy7EBvwMnZwIG7OOohJb
|
||||
vkSpADK6VPn9lbqq7O8cTedEHttm6otmLt8ZyEl3hZMaL3hbuRj6ysjmoFKx6CrX
|
||||
rK0/Ikt5ybqUzKCMJZg2VKGTxg==
|
||||
-----END PRIVATE KEY-----)";
|
||||
std::string rsa_pub_key = R"(-----BEGIN PUBLIC KEY-----
|
||||
std::string rsa_pub_key = R"(-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuGbXWiK3dQTyCbX5xdE4
|
||||
yCuYp0AF2d15Qq1JSXT/lx8CEcXb9RbDddl8jGDv+spi5qPa8qEHiK7FwV2KpRE9
|
||||
83wGPnYsAm9BxLFb4YrLYcDFOIGULuk2FtrPS512Qea1bXASuvYXEpQNpGbnTGVs
|
||||
@@ -40,15 +40,14 @@ AziMCxS+VrRPDM+zfvpIJg3JljAh3PJHDiLu902v9w+Iplu1WyoB2aPfitxEhRN0
|
||||
YwIDAQAB
|
||||
-----END PUBLIC KEY-----)";
|
||||
|
||||
auto token =
|
||||
jwt::create()
|
||||
.set_issuer("auth0")
|
||||
.set_type("JWT")
|
||||
.set_id("rsa-create-example")
|
||||
.set_issued_at(std::chrono::system_clock::now())
|
||||
.set_expires_at(std::chrono::system_clock::now() + std::chrono::seconds{36000})
|
||||
.set_payload_claim("sample", jwt::claim(std::string{"test"}))
|
||||
.sign(jwt::algorithm::rs256(rsa_pub_key, rsa_priv_key, "", ""));
|
||||
auto token = jwt::create()
|
||||
.set_issuer("auth0")
|
||||
.set_type("JWT")
|
||||
.set_id("rsa-create-example")
|
||||
.set_issued_at(std::chrono::system_clock::now())
|
||||
.set_expires_at(std::chrono::system_clock::now() + std::chrono::seconds{36000})
|
||||
.set_payload_claim("sample", jwt::claim(std::string{"test"}))
|
||||
.sign(jwt::algorithm::rs256(rsa_pub_key, rsa_priv_key, "", ""));
|
||||
|
||||
std::cout << "token:\n" << token << std::endl;
|
||||
std::cout << "token:\n" << token << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user