blob: 7e8e5031ac5a920d03469d6c1359f0b47fbd1463 [file] [log] [blame]
Ed Tanousf9273472017-02-28 16:05:13 -08001#pragma once
2
3#include <crow/http_request.h>
4#include <crow/http_response.h>
5
Ed Tanous99923322017-03-03 14:21:24 -08006namespace crow {
7struct TokenAuthorizationMiddleware {
8 struct context {
9 std::unordered_map<std::string, std::string> cookie_sessions;
10 std::unordered_map<std::string, std::string> cookies_to_push_to_client;
Ed Tanousf9273472017-02-28 16:05:13 -080011
Ed Tanous99923322017-03-03 14:21:24 -080012 std::string get_cookie(const std::string& key);
Ed Tanousf9273472017-02-28 16:05:13 -080013
Ed Tanous99923322017-03-03 14:21:24 -080014 void set_cookie(const std::string& key, const std::string& value);
15 };
Ed Tanousf9273472017-02-28 16:05:13 -080016
Ed Tanous99923322017-03-03 14:21:24 -080017 void before_handle(crow::request& req, response& res, context& ctx);
Ed Tanousf9273472017-02-28 16:05:13 -080018
Ed Tanous99923322017-03-03 14:21:24 -080019 void after_handle(request& req, response& res, context& ctx);
20};
Ed Tanousf9273472017-02-28 16:05:13 -080021}