#ifndef TOKEN_MANAGER_H_ #define TOKEN_MANAGER_H_ #include #include #include #include #include #include #include #include "model/Models.h" #include "type/Scopes.h" namespace manager { class TokenManager { public: TokenManager(); model::LoginResult retrieveToken(const model::BinaryPath&); bool isTokenValid(std::string&, type::Scope); bool testAuth(const model::BinaryPath&); private: cpr::Response sendRequest(std::string_view, nlohmann::json&); nlohmann::json createTokenBody(const model::AuthCredentials&); model::AuthCredentials parseAuthCredentials(std::string_view); model::AuthCredentials parseAuthCredentials(const model::BinaryPath&); std::vector extractScopes(const jwt::decoded_jwt&&); std::pair> fetchAuthHeader(const std::string&); bool tokenSupportsScope(const std::vector, const std::string&&); }; } #endif