blob: 160265610c9f1e36837f9202e0e8163817562b98 [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 {
Ed Tanousb4d29f42017-03-24 16:39:25 -07007
8struct User {
9
10};
11
Ed Tanous99923322017-03-03 14:21:24 -080012struct TokenAuthorizationMiddleware {
Ed Tanousb4d29f42017-03-24 16:39:25 -070013 // 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 Tanous99923322017-03-03 14:21:24 -080016 struct context {
Ed Tanousc4771fb2017-03-13 13:39:49 -070017 std::string auth_token;
Ed Tanous99923322017-03-03 14:21:24 -080018 };
Ed Tanousf9273472017-02-28 16:05:13 -080019
Ed Tanousc4771fb2017-03-13 13:39:49 -070020 std::string auth_token2;
21
Ed Tanous99923322017-03-03 14:21:24 -080022 void before_handle(crow::request& req, response& res, context& ctx);
Ed Tanousf9273472017-02-28 16:05:13 -080023
Ed Tanous99923322017-03-03 14:21:24 -080024 void after_handle(request& req, response& res, context& ctx);
25};
Ed Tanousf9273472017-02-28 16:05:13 -080026}