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

#include <crow/http_request.h>
#include <crow/http_response.h>
#include <boost/container/flat_set.hpp>

namespace crow {

struct User {};

struct TokenAuthorizationMiddleware {
  // TODO(ed) auth_token shouldn't really be passed to the context
  // it opens the possibility of exposure by and endpoint.
  // instead we should only pass some kind of "user" struct
  struct context {
    //std::string auth_token;
  };

  TokenAuthorizationMiddleware();

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

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

 private:
  boost::container::flat_set<std::string> auth_token2;
};
}