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.h
Go to the documentation of this file.
1 
31 #pragma once
32 
33 #include <string>
34 #include <deque>
35 #include <unordered_map>
36 #include "cpprest/json.h"
37 #include "cpprest/http_msg.h"
38 #include "cpprest/oauth2.h"
39 #include "granada/defaults.h"
40 #include "granada/util/memory.h"
41 #include "granada/util/vector.h"
43 #include "granada/util/time.h"
44 #include "granada/http/parser.h"
49 
53 typedef utility::string_t oauth2_error;
55 {
56 public:
57 #define _OAUTH2_ERRORS
58 #define DAT(a_, b_) _ASYNCRTIMP static const oauth2_error a_;
59 #include "granada/http/http_constants.dat"
60 #undef _OAUTH2_ERRORS
61 #undef DAT
62 };
63 
64 
68 typedef utility::string_t oauth2_error_description;
70 {
71 public:
72 #define _OAUTH2_ERRORS_DESCRIPTION
73 #define DAT(a_, b_) _ASYNCRTIMP static const oauth2_error_description a_;
74 #include "granada/http/http_constants.dat"
75 #undef _OAUTH2_ERRORS_DESCRIPTION
76 #undef DAT
77 };
78 
79 
83 typedef utility::string_t oauth2_client_type;
85 {
86 public:
87 #define _OAUTH2_CLIENT_TYPES
88 #define DAT(a_, b_) _ASYNCRTIMP static const oauth2_client_type a_;
89 #include "granada/http/http_constants.dat"
90 #undef _OAUTH2_CLIENT_TYPES
91 #undef DAT
92 };
93 
94 
99 typedef utility::string_t oauth2_string_2;
101 {
102 public:
103 #define _OAUTH2_STRINGS_2
104 #define DAT(a_, b_) _ASYNCRTIMP static const oauth2_string_2 a_;
105 #include "granada/http/http_constants.dat"
106 #undef _OAUTH2_STRINGS_2
107 #undef DAT
108 };
109 
114 typedef utility::string_t oauth2_template;
116 {
117 public:
118 #define _TEMPLATES
119 #define TEMPLATES(a_, b_) _ASYNCRTIMP static const oauth2_template a_;
120 #include "granada/http/oauth2/oauth2.templates"
121 #undef _TEMPLATES
122 #undef TEMPLATES
123 };
124 
125 using namespace web::http::oauth2::details;
126 
127 namespace granada{
128 
129  namespace http{
130 
131  namespace oauth2{
132 
133  class OAuth2Factory;
134 
141  public:
142 
147 
148 
154  OAuth2Parameters(const std::string& query_string){
155  try{
156  std::unordered_map<std::string, std::string> parsed_data = granada::http::parser::ParseQueryString(query_string);
157  username.assign(parsed_data[oauth2_strings_2::username]);
158  password.assign(parsed_data[oauth2_strings_2::password]);
159  code.assign(parsed_data[oauth2_strings::code]);
160  authorize.assign(parsed_data[oauth2_strings_2::authorize]);
161  access_token.assign(parsed_data[oauth2_strings::access_token]);
162  expires_in.assign(parsed_data[oauth2_strings::expires_in]);
163  refresh_token.assign(parsed_data[oauth2_strings::refresh_token]);
164  token_type.assign(parsed_data[oauth2_strings::token_type]);
165  grant_type.assign(parsed_data[oauth2_strings::grant_type]);
166  response_type.assign(parsed_data[oauth2_strings::response_type]);
167  client_id.assign(parsed_data[oauth2_strings::client_id]);
168  client_secret.assign(parsed_data[oauth2_strings::client_secret]);
169  redirect_uri.assign(parsed_data[oauth2_strings::redirect_uri]);
170  scope.assign(parsed_data[oauth2_strings::scope]);
171  state.assign(parsed_data[oauth2_strings::state]);
172  error.assign(parsed_data[oauth2_errors::error]);
173  error_description.assign(parsed_data[oauth2_errors::error_description]);
174  }catch(const std::exception& e){}
175  };
176 
177 
183  std::unordered_map<std::string,std::string> to_unordered_map(){
184  std::unordered_map<std::string,std::string> map;
185  if (!code.empty()){ map.insert(std::make_pair(oauth2_strings::code,code)); }
186  if (!access_token.empty()){ map.insert(std::make_pair(oauth2_strings::access_token,access_token)); }
187  if (!expires_in.empty()){ map.insert(std::make_pair(oauth2_strings::expires_in,expires_in)); }
188  if (!refresh_token.empty()){ map.insert(std::make_pair(oauth2_strings::refresh_token,refresh_token)); }
189  if (!token_type.empty()){ map.insert(std::make_pair(oauth2_strings::token_type,token_type)); }
190  if (!grant_type.empty()){ map.insert(std::make_pair(oauth2_strings::grant_type,grant_type)); }
191  if (!response_type.empty()){ map.insert(std::make_pair(oauth2_strings::response_type,response_type)); }
192  if (!client_id.empty()){ map.insert(std::make_pair(oauth2_strings::client_id,client_id)); }
193  if (!redirect_uri.empty()){ map.insert(std::make_pair(oauth2_strings::redirect_uri,redirect_uri)); }
194  if (!scope.empty()){ map.insert(std::make_pair(oauth2_strings::scope,scope)); }
195  if (!state.empty()){ map.insert(std::make_pair(oauth2_strings::state,state)); }
196  if (!error.empty()){ map.insert(std::make_pair(oauth2_errors::error,error)); }
197  if (!error_description.empty()){ map.insert(std::make_pair(oauth2_errors::error_description,error_description)); }
198  return map;
199  }
200 
201 
209  std::string to_query_string(){
210  std::string query_string = "";
211  if (!code.empty()){ query_string+="&"+oauth2_strings::code+"="+code; }
212  if (!access_token.empty()){ query_string+="&"+oauth2_strings::access_token+"="+access_token; }
213  if (!expires_in.empty()){ query_string+="&"+oauth2_strings::expires_in+"="+expires_in; }
214  if (!refresh_token.empty()){ query_string+="&"+oauth2_strings::refresh_token+"="+refresh_token; }
215  if (!token_type.empty()){ query_string+="&"+oauth2_strings::token_type+"="+token_type; }
216  if (!grant_type.empty()){ query_string+="&"+oauth2_strings::grant_type+"="+grant_type; }
217  if (!response_type.empty()){ query_string+="&"+oauth2_strings::response_type+"="+response_type; }
218  if (!client_id.empty()){ query_string+="&"+oauth2_strings::client_id+"="+client_id; }
219  if (!redirect_uri.empty()){ query_string+="&"+oauth2_strings::redirect_uri+"="+redirect_uri; }
220  if (!scope.empty()){ query_string+="&"+oauth2_strings::scope+"="+scope; }
221  if (!state.empty()){ query_string+="&"+oauth2_strings::state+"="+state; }
222  if (!error.empty()){ query_string+="&"+oauth2_errors::error+"="+error; }
223  if (!error_description.empty()){ query_string+="&"+oauth2_errors::error_description+"="+error_description; }
224  if (!query_string.empty()){
225  query_string[0] = '?';
226  }
227  return query_string;
228  }
229 
230 
244  web::json::value to_json(){
245  std::string json_str = "";
246  if (!code.empty()){ json_str+=",\""+oauth2_strings::code+"\":\""+code+"\""; }
247  if (!access_token.empty()){ json_str+=",\""+oauth2_strings::access_token+"\":\""+access_token+"\""; }
248  if (!expires_in.empty()){ json_str+=",\""+oauth2_strings::expires_in+"\":\""+expires_in+"\""; }
249  if (!refresh_token.empty()){ json_str+=",\""+oauth2_strings::refresh_token+"\":\""+refresh_token+"\""; }
250  if (!token_type.empty()){ json_str+=",\""+oauth2_strings::token_type+"\":\""+token_type+"\""; }
251  if (!grant_type.empty()){ json_str+=",\""+oauth2_strings::grant_type+"\":\""+grant_type+"\""; }
252  if (!response_type.empty()){ json_str+=",\""+oauth2_strings::response_type+"\":\""+response_type+"\""; }
253  if (!client_id.empty()){ json_str+=",\""+oauth2_strings::client_id+"\":\""+client_id+"\""; }
254  if (!redirect_uri.empty()){ json_str+=",\""+oauth2_strings::redirect_uri+"\":\""+redirect_uri+"\""; }
255  if (!scope.empty()){ json_str+=",\""+oauth2_strings::scope+"\":\""+scope+"\""; }
256  if (!state.empty()){ json_str+=",\""+oauth2_strings::state+"\":\""+state+"\""; }
257  if (!error.empty()){ json_str+=",\""+oauth2_errors::error+"\":\""+error+"\""; }
258  if (!error_description.empty()){ json_str+=",\""+oauth2_errors::error_description+"\":\""+error_description+"\""; }
259  if (json_str.empty()){
260  json_str = "{}";
261  }else{
262  json_str[0] = '{';
263  json_str += "}";
264  }
265  return web::json::value::parse(json_str);
266  }
267 
268 
269  std::string username;
270  std::string password;
271  std::string code;
272  std::string authorize;
273  std::string access_token;
274  std::string expires_in;
275  std::string refresh_token;
276  std::string token_type;
277  std::string grant_type;
278  std::string response_type;
279  std::string client_id;
280  std::string client_secret;
281  std::string redirect_uri;
282  std::string scope;
283  std::string state;
284  std::string error;
285  std::string error_description;
286  };
287 
288 
293  public:
294 
300  return nullptr;
301  };
302 
303 
309  return nullptr;
310  };
311 
312 
318  return nullptr;
319  };
320 
321 
326  virtual const bool Exists(){
327  return cache()->Exists(hash());
328  };
329 
330 
334  virtual void Load(){};
335 
336 
342  virtual void Load(const std::string& identifier){};
343 
344 
345  protected:
346 
347 
352  virtual const std::string hash(){
353  return std::string();
354  };
355 
356 
362  virtual void LoadProperties(){};
363  };
364 
365 
369  class OAuth2Client : public OAuth2Entity{
370  public:
371 
372 
378 
379 
385  OAuth2Client(const std::string& id){};
386 
387 
393  virtual void Load() override;
394 
395 
402  virtual void Load(const std::string& identifier) override;
403 
404 
427  virtual void Create(const std::string& type, const std::vector<std::string>& redirect_uris, const std::string& application_name, const std::vector<std::string>& roles, std::string& secret);
428 
429 
437  virtual bool CorrectCredentials(std::string secret);
438 
439 
445  virtual bool Delete(const std::string& secret);
446 
447 
456  virtual const bool HasRedirectURI(const std::string& redirect_uri){
457  return (std::find(redirect_uris_.begin(), redirect_uris_.end(), redirect_uri) != redirect_uris_.end());
458  };
459 
460 
467  virtual const bool HasRole(const std::string& role){
468  return std::find(roles_.begin(), roles_.end(), role) != roles_.end();
469  };
470 
471 
472  virtual const std::string GetId(){
473  return id_;
474  };
475 
476 
477  virtual void SetId(const std::string& id){
478  id_.assign(id);
479  };
480 
481 
482  virtual const std::string GetType(){
483  return type_;
484  };
485 
486  virtual const std::string GetApplicationName(){
487  return application_name_;
488  };
489 
490  virtual const std::vector<std::string> GetRedirectURIs(){
491  return redirect_uris_;
492  };
493 
494 
495  virtual const std::vector<std::string> GetRoles(){
496  return roles_;
497  };
498 
499  virtual const std::time_t GetCreationTime(){
500  return creation_time_;
501  };
502 
503 
504  protected:
505 
506 
510  static std::mutex oauth2_client_creation_mtx_;
511 
512 
519  static std::string cache_namespace_;
520 
521 
525  static int client_id_length_;
526 
527 
531  std::string id_;
532 
533 
538  std::string key_;
539 
540 
553  std::string type_;
554 
555 
560  std::string application_name_;
561 
562 
567  std::vector<std::string> redirect_uris_;
568 
569 
574  std::vector<std::string> roles_;
575 
576 
580  std::time_t creation_time_;
581 
582 
589  virtual void LoadProperties();
590 
591 
601  virtual const std::string hash() override {
602  return cache_namespace_ + id_;
603  };
604 
605  };
606 
607 
614  class OAuth2User : public OAuth2Entity{
615 
616  public:
617 
623 
624 
630  OAuth2User(const std::string& username){};
631 
632 
638  virtual void Load() override;
639 
646  virtual void Load(const std::string& identifier) override;
647 
648 
659  virtual bool Create(const std::string& username, std::string& password, const web::json::value& roles);
660 
661 
669  virtual bool CorrectCredentials(std::string password);
670 
671 
677  virtual bool Delete(const std::string& password);
678 
679 
686  virtual const bool HasRole(const std::string& role){
687  return roles_.is_null()? false : roles_.has_field(role);
688  };
689 
690 
691  virtual const std::string GetUsername(){
692  return username_;
693  };
694 
695  virtual void SetUsername(const std::string& username){
696  username_.assign(username);
697  };
698 
699  virtual web::json::value GetRoles(){
700  return roles_;
701  };
702 
703  virtual const std::time_t GetCreationTime(){
704  return creation_time_;
705  };
706 
707 
708  protected:
709 
713  static std::mutex oauth2_user_creation_mtx_;
714 
715 
722  static std::string cache_namespace_;
723 
724 
728  std::string username_;
729 
730 
735  std::string key_;
736 
737 
742  web::json::value roles_;
743 
744 
748  std::time_t creation_time_;
749 
750 
757  virtual void LoadProperties();
758 
759 
768  virtual const std::string hash() override {
769  return cache_namespace_ + username_;
770  };
771 
772  };
773 
774 
796  class OAuth2Code : public OAuth2Entity{
797 
798  public:
799 
805 
806 
812  OAuth2Code(const std::string& code){};
813 
814 
820  virtual void Load() override;
821 
822 
829  virtual void Load(const std::string& identifier) override;
830 
831 
840  virtual void Create(const std::string& client_id, const std::string& roles, const std::string& username);
841 
842 
846  virtual void Delete();
847 
848 
849  virtual const std::string GetCode(){
850  return code_;
851  };
852 
853 
854  virtual void SetCode(const std::string& code){
855  code_.assign(code);
856  };
857 
858 
859  virtual const std::string GetClientId(){
860  return client_id_;
861  };
862 
863 
864  virtual const std::string GetUsername(){
865  return username_;
866  };
867 
868 
869  virtual const std::vector<std::string> GetRoles(){
870  return roles_;
871  };
872 
873 
874  virtual const std::time_t GetCreationTime(){
875  return creation_time_;
876  };
877 
878  protected:
879 
883  static std::mutex oauth2_code_creation_mtx_;
884 
885 
892  static std::string cache_namespace_;
893 
894 
898  static int code_length_;
899 
900 
904  std::string code_;
905 
906 
910  std::string client_id_;
911 
912 
916  std::string username_;
917 
918 
923  std::vector<std::string> roles_;
924 
925 
929  std::time_t creation_time_;
930 
931 
938  virtual void LoadProperties();
939 
940 
950  virtual const std::string hash() override {
951  return cache_namespace_ + code_;
952  };
953 
954  };
955 
961  public:
962 
968 
974  granada::http::session::SessionFactory* session_factory){};
975 
976 
983  virtual granada::http::oauth2::OAuth2Parameters Grant(web::http::http_request &request, web::http::http_response& response);
984 
985 
993  virtual web::json::value Information();
994 
995 
1002  virtual web::json::value Delete();
1003 
1004 
1005  protected:
1006 
1007 
1014  static std::string cache_namespace_;
1015 
1016 
1023 
1024 
1031 
1032 
1039 
1040 
1047  virtual void LoadProperties();
1048 
1049 
1063  virtual const std::string hash() override {
1064  return cache_namespace_ + oauth2_parameters_.username + ":" + oauth2_parameters_.client_id + ":" + oauth2_parameters_.code + ":" + oauth2_parameters_.access_token;
1065  };
1066 
1067 
1076  virtual void CheckClient(std::unique_ptr<granada::http::oauth2::OAuth2Client>& oauth2_client,
1077  granada::http::oauth2::OAuth2Parameters& oauth2_response);
1078 
1079 
1099  virtual void CheckCredentials(granada::http::oauth2::OAuth2Client* oauth2_client,
1100  std::unique_ptr<granada::http::oauth2::OAuth2User>& oauth2_user,
1101  std::unique_ptr<granada::http::oauth2::OAuth2Code>& oauth2_code,
1102  std::unique_ptr<granada::http::session::Session>& oauth2_user_session,
1103  granada::http::oauth2::OAuth2Parameters& oauth2_response,
1104  web::http::http_request& request,
1105  web::http::http_response& response);
1106 
1107 
1122  virtual void CreateCode(std::unique_ptr<granada::http::session::Session>& oauth2_user_session,
1123  std::unique_ptr<granada::http::oauth2::OAuth2Code>& oauth2_code,
1124  granada::http::oauth2::OAuth2User* oauth2_user,
1125  granada::http::oauth2::OAuth2Parameters& oauth2_response,
1126  web::http::http_request& request,
1127  web::http::http_response& response);
1128 
1129 
1148  virtual void CreateAccessToken(std::vector<std::string>& roles,
1149  std::unique_ptr<granada::http::session::Session>& oauth2_user_session,
1150  granada::http::oauth2::OAuth2User* oauth2_user,
1151  std::unique_ptr<granada::http::oauth2::OAuth2Code>& oauth2_code,
1152  granada::http::oauth2::OAuth2Parameters& oauth2_response,
1153  web::http::http_request& request,
1154  web::http::http_response& response);
1155 
1156 
1166  virtual void CreateRefreshToken(granada::http::session::Session* oauth2_client_session,
1167  std::unique_ptr<granada::http::oauth2::OAuth2Code>& oauth2_code,
1168  granada::http::oauth2::OAuth2Parameters& oauth2_response);
1169 
1170 
1184  virtual bool CheckRoleAllowance(std::vector<std::string>& roles,
1185  granada::http::oauth2::OAuth2Client* oauth2_client,
1186  granada::http::oauth2::OAuth2User* oauth2_user);
1187 
1188 
1197  virtual void AssignRolesToClientSession(std::vector<std::string>& roles,
1198  const web::json::value& user_roles,
1199  granada::http::session::Session* oauth2_client_session);
1200 
1201 
1213  virtual void AssignRolesToOAuth2UserSession(std::unique_ptr<granada::http::session::Session>& oauth2_user_session,
1214  const web::json::value& user_roles,
1215  web::http::http_request& request,
1216  web::http::http_response& response);
1217 
1218 
1220  return nullptr;
1221  };
1222 
1223 
1225  return session_factory_;
1226  };
1227 
1228  };
1229 
1230 
1236 
1237  public:
1238 
1239  virtual std::unique_ptr<granada::http::oauth2::OAuth2Client>OAuth2Client_unique_ptr(){
1240  return granada::util::memory::make_unique<granada::http::oauth2::OAuth2Client>();
1241  };
1242 
1243  virtual std::unique_ptr<granada::http::oauth2::OAuth2Client>OAuth2Client_unique_ptr(const std::string& client_id){
1244  return granada::util::memory::make_unique<granada::http::oauth2::OAuth2Client>(client_id);
1245  };
1246 
1247  virtual std::unique_ptr<granada::http::oauth2::OAuth2User>OAuth2User_unique_ptr(){
1248  return granada::util::memory::make_unique<granada::http::oauth2::OAuth2User>();
1249  };
1250 
1251  virtual std::unique_ptr<granada::http::oauth2::OAuth2User>OAuth2User_unique_ptr(const std::string& username){
1252  return granada::util::memory::make_unique<granada::http::oauth2::OAuth2User>(username);
1253  };
1254 
1255  virtual std::unique_ptr<granada::http::oauth2::OAuth2Code>OAuth2Code_unique_ptr(){
1256  return granada::util::memory::make_unique<granada::http::oauth2::OAuth2Code>();
1257  };
1258 
1259  virtual std::unique_ptr<granada::http::oauth2::OAuth2Code>OAuth2Code_unique_ptr(const std::string& code){
1260  return granada::util::memory::make_unique<granada::http::oauth2::OAuth2Code>(code);
1261  };
1262 
1263  virtual std::unique_ptr<granada::http::oauth2::OAuth2Authorization>OAuth2Authorization_unique_ptr(){
1264  return granada::util::memory::make_unique<granada::http::oauth2::OAuth2Authorization>();
1265  };
1266 
1267  virtual std::unique_ptr<granada::http::oauth2::OAuth2Authorization>OAuth2Authorization_unique_ptr(const granada::http::oauth2::OAuth2Parameters& oauth2_parameters,
1268  granada::http::session::SessionFactory* session_factory){
1269  return granada::util::memory::make_unique<granada::http::oauth2::OAuth2Authorization>(oauth2_parameters,session_factory);
1270  };
1271 
1272  };
1273  }
1274  }
1275 }
std::string client_secret
Definition: oauth2.h:280
std::string authorize
Definition: oauth2.h:272
virtual void SetCode(const std::string &code)
Definition: oauth2.h:854
std::string client_id_
Definition: oauth2.h:910
std::string refresh_token
Definition: oauth2.h:275
Definition: oauth2.h:84
std::string error_description
Definition: oauth2.h:285
std::string response_type
Definition: oauth2.h:278
static bool oauth2_use_refresh_token_
Definition: oauth2.h:1022
std::unordered_map< std::string, std::string > to_unordered_map()
Definition: oauth2.h:183
virtual const std::string hash() override
Definition: oauth2.h:1063
OAuth2Code(const std::string &code)
Definition: oauth2.h:812
virtual const std::string GetApplicationName()
Definition: oauth2.h:486
virtual void LoadProperties()
Definition: oauth2.h:362
virtual granada::cache::CacheHandler * cache()
Definition: oauth2.h:299
Definition: oauth2.h:115
virtual const std::string GetClientId()
Definition: oauth2.h:859
utility::string_t oauth2_string_2
Definition: oauth2.h:99
virtual const bool Exists()
Definition: oauth2.h:326
std::string to_query_string()
Definition: oauth2.h:209
granada::http::session::SessionFactory * session_factory_
Definition: oauth2.h:1030
virtual const std::string hash() override
Definition: oauth2.h:601
virtual const std::vector< std::string > GetRoles()
Definition: oauth2.h:495
virtual granada::http::session::SessionFactory * session_factory()
Definition: oauth2.h:1224
Definition: nonce_generator.h:9
virtual std::unique_ptr< granada::http::oauth2::OAuth2Client > OAuth2Client_unique_ptr(const std::string &client_id)
Definition: oauth2.h:1243
std::string password
Definition: oauth2.h:270
std::string type_
Definition: oauth2.h:553
virtual const bool HasRole(const std::string &role)
Definition: oauth2.h:686
virtual const std::string GetId()
Definition: oauth2.h:472
std::vector< std::string > roles_
Definition: oauth2.h:574
std::string redirect_uri
Definition: oauth2.h:281
std::unordered_map< std::string, std::string > ParseQueryString(const std::string &query_string)
virtual const std::vector< std::string > GetRedirectURIs()
Definition: oauth2.h:490
std::string key_
Definition: oauth2.h:538
static std::string cache_namespace_
Definition: oauth2.h:1014
virtual granada::crypto::Cryptograph * cryptograph()
Definition: oauth2.h:308
virtual granada::crypto::NonceGenerator * nonce_generator()
Definition: oauth2.h:317
std::string error
Definition: oauth2.h:284
std::vector< std::string > roles_
Definition: oauth2.h:923
std::string client_id
Definition: oauth2.h:279
Definition: oauth2.h:796
Definition: oauth2.h:614
Definition: oauth2.h:292
utility::string_t oauth2_template
Definition: oauth2.h:114
OAuth2Parameters()
Definition: oauth2.h:146
std::string state
Definition: oauth2.h:283
virtual std::unique_ptr< granada::http::oauth2::OAuth2Authorization > OAuth2Authorization_unique_ptr(const granada::http::oauth2::OAuth2Parameters &oauth2_parameters, granada::http::session::SessionFactory *session_factory)
Definition: oauth2.h:1267
virtual const std::string hash() override
Definition: oauth2.h:950
virtual const std::string GetCode()
Definition: oauth2.h:849
Definition: oauth2.h:369
virtual const std::time_t GetCreationTime()
Definition: oauth2.h:874
Definition: session.h:61
virtual const std::string hash() override
Definition: oauth2.h:768
Definition: oauth2.h:1235
std::string code_
Definition: oauth2.h:904
OAuth2Code()
Definition: oauth2.h:804
static std::time_t parse(const std::string &time_str)
Definition: time.h:47
virtual std::unique_ptr< granada::http::oauth2::OAuth2User > OAuth2User_unique_ptr(const std::string &username)
Definition: oauth2.h:1251
virtual void SetId(const std::string &id)
Definition: oauth2.h:477
std::string code
Definition: oauth2.h:271
virtual web::json::value GetRoles()
Definition: oauth2.h:699
virtual const bool HasRedirectURI(const std::string &redirect_uri)
Definition: oauth2.h:456
granada::http::oauth2::OAuth2Parameters oauth2_parameters_
Definition: oauth2.h:1038
static int client_id_length_
Definition: oauth2.h:525
virtual const std::vector< std::string > GetRoles()
Definition: oauth2.h:869
virtual const bool HasRole(const std::string &role)
Definition: oauth2.h:467
OAuth2Client()
Definition: oauth2.h:377
virtual std::unique_ptr< granada::http::oauth2::OAuth2Client > OAuth2Client_unique_ptr()
Definition: oauth2.h:1239
std::string application_name_
Definition: oauth2.h:560
virtual const std::string GetType()
Definition: oauth2.h:482
std::time_t creation_time_
Definition: oauth2.h:580
std::string scope
Definition: oauth2.h:282
virtual const std::time_t GetCreationTime()
Definition: oauth2.h:703
virtual void SetUsername(const std::string &username)
Definition: oauth2.h:695
virtual void Load(const std::string &identifier)
Definition: oauth2.h:342
web::json::value roles_
Definition: oauth2.h:742
Definition: oauth2.h:54
virtual std::unique_ptr< granada::http::oauth2::OAuth2Code > OAuth2Code_unique_ptr(const std::string &code)
Definition: oauth2.h:1259
utility::string_t oauth2_client_type
Definition: oauth2.h:83
virtual granada::http::oauth2::OAuth2Factory * factory()
Definition: oauth2.h:1219
OAuth2Parameters(const std::string &query_string)
Definition: oauth2.h:154
std::string grant_type
Definition: oauth2.h:277
virtual void Load()
Definition: oauth2.h:334
static std::string cache_namespace_
Definition: oauth2.h:519
std::string access_token
Definition: oauth2.h:273
std::string id_
Definition: oauth2.h:531
virtual const std::string GetUsername()
Definition: oauth2.h:864
static std::string cache_namespace_
Definition: oauth2.h:892
utility::string_t oauth2_error
Definition: oauth2.h:53
virtual std::unique_ptr< granada::http::oauth2::OAuth2Authorization > OAuth2Authorization_unique_ptr()
Definition: oauth2.h:1263
OAuth2Authorization(const granada::http::oauth2::OAuth2Parameters &oauth2_parameters, granada::http::session::SessionFactory *session_factory)
Definition: oauth2.h:973
std::string username_
Definition: oauth2.h:916
Definition: oauth2.h:69
static int code_length_
Definition: oauth2.h:898
virtual const std::string GetUsername()
Definition: oauth2.h:691
utility::string_t oauth2_error_description
Definition: oauth2.h:68
std::string key_
Definition: oauth2.h:735
OAuth2User(const std::string &username)
Definition: oauth2.h:630
std::string username
Definition: oauth2.h:269
std::time_t creation_time_
Definition: oauth2.h:748
virtual std::unique_ptr< granada::http::oauth2::OAuth2User > OAuth2User_unique_ptr()
Definition: oauth2.h:1247
virtual const std::time_t GetCreationTime()
Definition: oauth2.h:499
Definition: cryptograph.h:32
OAuth2Client(const std::string &id)
Definition: oauth2.h:385
static std::string cache_namespace_
Definition: oauth2.h:722
OAuth2User()
Definition: oauth2.h:622
OAuth2Authorization()
Definition: oauth2.h:967
virtual const std::string hash()
Definition: oauth2.h:352
virtual std::unique_ptr< granada::http::oauth2::OAuth2Code > OAuth2Code_unique_ptr()
Definition: oauth2.h:1255
Definition: oauth2.h:100
std::vector< std::string > redirect_uris_
Definition: oauth2.h:567
Definition: cache_handler.h:128
std::time_t creation_time_
Definition: oauth2.h:929
std::string username_
Definition: oauth2.h:728
web::json::value to_json()
Definition: oauth2.h:244
std::string token_type
Definition: oauth2.h:276
std::string expires_in
Definition: oauth2.h:274