feat(CIE): Implement OIDC RP Service with login, callback, and session management
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include <json/json.h>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace visione::oidc
|
||||
{
|
||||
struct Jwk
|
||||
{
|
||||
std::string kty;
|
||||
std::string use;
|
||||
std::string alg;
|
||||
std::string kid;
|
||||
std::string n;
|
||||
std::string e;
|
||||
std::string d;
|
||||
std::string p;
|
||||
std::string q;
|
||||
};
|
||||
|
||||
struct JwtParts
|
||||
{
|
||||
Json::Value header;
|
||||
Json::Value payload;
|
||||
std::string encodedHeader;
|
||||
std::string encodedPayload;
|
||||
std::string encodedSignature;
|
||||
};
|
||||
|
||||
Jwk parseJwk(const Json::Value &value);
|
||||
Json::Value jwkToPublicJson(const Jwk &jwk);
|
||||
|
||||
std::string base64UrlEncode(const std::string &value);
|
||||
std::string base64UrlDecode(const std::string &value);
|
||||
std::string randomUrlSafeString(size_t sizeBytes);
|
||||
|
||||
std::string signJwt(const Json::Value &header,
|
||||
const Json::Value &payload,
|
||||
const Jwk &jwk);
|
||||
bool verifyJwtSignature(const std::string &jwt, const Jwk &jwk);
|
||||
JwtParts parseJwt(const std::string &jwt);
|
||||
Json::Value parseJsonObjectJwtPayload(const std::string &jwt);
|
||||
|
||||
std::optional<Jwk> findJwkByKid(const std::vector<Jwk> &jwks,
|
||||
const std::string &kid);
|
||||
|
||||
std::string sha256Base64Url(const std::string &value);
|
||||
std::string leftHashBase64Url(const std::string &value);
|
||||
} // namespace visione::oidc
|
||||
Reference in New Issue
Block a user