/
Shymer123
/
LumenServer
Обзор
Документация
Войти
/
Shymer123
/
LumenServer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Server/SourceFiles/Core/Network/Handlers/AuthHandler.cpp
41 строка
1 KB
Shymer123
Initial commit: LumenServer
20 июн 2026, 12:43
20 июн 2026, 12:43
173f14c
Код
Авторство
О чём код?
#include "AuthHandler.h" namespace Core::Network::Handlers { AuthHandler::AuthHandler(Controllers::AuthController& controller, Core::Middleware::AuthMiddleware& middleware) : m_controller(controller), m_middleware(middleware) {} nlohmann::json AuthHandler::handleGetAuthData(const nlohmann::json& req) { return m_controller.handleGetAuthData(req); } nlohmann::json AuthHandler::handleLogin(const nlohmann::json& req) { return m_controller.handleLogin(req); } nlohmann::json AuthHandler::handleRegister(const nlohmann::json& req) { return m_controller.handleRegister(req); } nlohmann::json AuthHandler::handleAutoLogin(const nlohmann::json& req) { return m_controller.handleAutoLogin(req); } nlohmann::json AuthHandler::handleLogout(const nlohmann::json& req, Network::RequestContext& ctx) { std::string accessToken = req.value("access_token", ""); if(!m_middleware.handle(accessToken, ctx)) { return {{"status", "error"}, {"message", "Unauthorized"}}; } ctx.body = Network::JsonBody{req}; return m_controller.handleLogout(ctx); } } // namespace Core::Network::Handlers