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 { |
Ed Tanous | b4d29f4 | 2017-03-24 16:39:25 -0700 | [diff] [blame] | 7 | |
8 | struct User { | ||||
9 | |||||
10 | }; | ||||
11 | |||||
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame] | 12 | struct TokenAuthorizationMiddleware { |
Ed Tanous | b4d29f4 | 2017-03-24 16:39:25 -0700 | [diff] [blame] | 13 | // TODO(ed) auth_token shouldn't really be passed to the context |
14 | // it opens the possibility of exposure by and endpoint. | ||||
15 | // instead we should only pass some kind of "user" struct | ||||
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame] | 16 | struct context { |
Ed Tanous | c4771fb | 2017-03-13 13:39:49 -0700 | [diff] [blame] | 17 | std::string auth_token; |
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame] | 18 | }; |
Ed Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 19 | |
Ed Tanous | 8041f31 | 2017-04-03 09:47:01 -0700 | [diff] [blame^] | 20 | TokenAuthorizationMiddleware(); |
Ed Tanous | c4771fb | 2017-03-13 13:39:49 -0700 | [diff] [blame] | 21 | |
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame] | 22 | void before_handle(crow::request& req, response& res, context& ctx); |
Ed Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 23 | |
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame] | 24 | void after_handle(request& req, response& res, context& ctx); |
Ed Tanous | 8041f31 | 2017-04-03 09:47:01 -0700 | [diff] [blame^] | 25 | |
26 | private: | ||||
27 | std::string auth_token2; | ||||
Ed Tanous | 9992332 | 2017-03-03 14:21:24 -0800 | [diff] [blame] | 28 | }; |
Ed Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 29 | } |