summaryrefslogtreecommitdiff
path: root/include/token_authorization_middleware.hpp
blob: 801c75f91bb5e5267b385b6f1d8485f225d51f29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include <crow/http_request.h>
#include <crow/http_response.h>

namespace crow
{
    struct TokenAuthorizationMiddleware {

        struct context {
            std::unordered_map<std::string, std::string> cookie_sessions;
            std::unordered_map<std::string, std::string> cookies_to_push_to_client;

            std::string get_cookie(const std::string& key);

            void set_cookie(const std::string& key, const std::string& value);
        };

        void before_handle(crow::request& req, response& res, context& ctx);

        void after_handle(request& req, response& res, context& ctx);
    };
}