generated from Sithas/conan_template
33 lines
727 B
C++
33 lines
727 B
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
#include <mysqlx/xdevapi.h>
|
|
|
|
#include "IAuthDAO.h"
|
|
|
|
namespace uad
|
|
{
|
|
class MemoryAuthDAO : public uad::IAuthDAO
|
|
{
|
|
std::unordered_map<std::string, std::string> users_uuids_to_auth_tokens_;
|
|
std::unordered_map<std::string, std::string> auth_tokens_to_users_uuids_;
|
|
|
|
mysqlx::Session& session_;
|
|
public:
|
|
explicit MemoryAuthDAO(mysqlx::Session& session);
|
|
|
|
std::string Login(
|
|
std::string_view registrated_user_uuid,
|
|
std::string_view auth_token) override;
|
|
|
|
bool HasAuthorized(std::string_view auth_token) override;
|
|
|
|
std::string_view GetUUID(std::string_view auth_token) override;
|
|
|
|
bool Logout(std::string_view auth_token) override;
|
|
};
|
|
}
|