Ed Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <crow/http_request.h> |
| 4 | #include <crow/http_response.h> |
| 5 | |
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame^] | 6 | namespace crow { |
| 7 | struct 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 Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 11 | |
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame^] | 12 | std::string get_cookie(const std::string& key); |
Ed Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 13 | |
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame^] | 14 | void set_cookie(const std::string& key, const std::string& value); |
| 15 | }; |
Ed Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 16 | |
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame^] | 17 | void before_handle(crow::request& req, response& res, context& ctx); |
Ed Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 18 | |
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame^] | 19 | void after_handle(request& req, response& res, context& ctx); |
| 20 | }; |
Ed Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 21 | } |