Granada  1.54.0
Structured layer on top of C++ REST SDK for building server applications in C++. Granada implements sessions, server side plug-in framework, C++ OAuth 2.0 server, data storage access, server script running, server browsing.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
oauth2_controller.h
Go to the documentation of this file.
1 
28 #pragma once
29 #include <deque>
30 #include <unordered_map>
31 #include <fstream>
32 #include "cpprest/json.h"
33 #include "granada/util/string.h"
34 #include "granada/util/file.h"
35 #include "granada/http/parser.h"
36 #include "granada/http/http_msg.h"
40 
41 namespace granada{
42  namespace http{
43  namespace controller{
44  class OAuth2Controller : public Controller {
45  public:
46 
55  utility::string_t url,
56  std::shared_ptr<granada::http::session::SessionFactory>& session_factory,
57  std::shared_ptr<granada::http::oauth2::OAuth2Factory>& oauth2_factory);
58 
59 
63  virtual ~OAuth2Controller(){};
64 
65 
66  private:
67 
71  static std::once_flag properties_flag_;
72 
73 
77  static std::string oauth2_authorize_uri_;
78 
79 
83  static std::string oauth2_logout_uri_;
84 
85 
90  static std::string oauth2_info_uri_;
91 
92 
97  static std::string oauth2_authorizing_login_template_;
98 
99 
104  static std::string oauth2_authorizing_message_template_;
105 
106 
111  static std::string oauth2_logout_template_;
112 
113 
118  static std::string oauth2_authorizing_error_template_;
119 
120 
124  utility::string_t url_;
125 
126 
131  std::shared_ptr<granada::http::session::SessionFactory> session_factory_;
132 
133 
138  std::shared_ptr<granada::http::oauth2::OAuth2Factory> oauth2_factory_;
139 
140 
193  void LoadProperties();
194 
195 
202  void LoadHTMLTemplate(const std::string& property_name, const std::string& default_template, std::string& html_template);
203 
204 
209  void handle_get(http_request request);
210 
211 
216  void handle_post(http_request request);
217 
218 
223  void handle_delete(http_request request);
224 
225  };
226  }
227  }
228 }
virtual ~OAuth2Controller()
Definition: oauth2_controller.h:63
Definition: controller.h:45
Definition: oauth2_controller.h:44
OAuth2Controller(utility::string_t url, std::shared_ptr< granada::http::session::SessionFactory > &session_factory, std::shared_ptr< granada::http::oauth2::OAuth2Factory > &oauth2_factory)