update for cross compile
This commit is contained in:
1 parent
8accbdc476
commit
e89bc07659
127 files changed
+238
-15518
No files matched your search
@@ -1,21 +1,12 @@
|
||||
#include "auth.hpp"
|
||||
#include <jwt-cpp/jwt.h>
|
||||
#include <jwt.hpp>
|
||||
#include "../includes.hpp"
|
||||
#include <syslog.h>
|
||||
|
||||
// function for verify tokens
|
||||
bool verify_auth(const std::string &token) {
|
||||
try {
|
||||
// parse token
|
||||
const jwt::decoded_jwt<jwt::traits::kazuho_picojson> decoded = jwt::decode(token);
|
||||
|
||||
// validate token
|
||||
const jwt::verifier<jwt::default_clock, jwt::traits::kazuho_picojson> verifier = jwt::verify()
|
||||
.allow_algorithm(jwt::algorithm::hs256{JWT_SECRET_KEY})
|
||||
.with_issuer("auth0");
|
||||
|
||||
verifier.verify(decoded);
|
||||
return true;
|
||||
return JWT::verifyJWT(token, JWT_DEFAULT_SECRET);
|
||||
} catch (const std::system_error &e) {
|
||||
std::cout << "Verification error: " << e.what() << std::endl;
|
||||
syslog(LOG_ERR, "token verification error");
|
||||
|
||||
Reference in new issue
Block a user