comparison Core/HttpServer/MongooseServer.h @ 25:dd1489098265

basic http authentication
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 Aug 2012 11:20:49 +0200
parents 166664f0f860
children 96e57b863dd9
comparison
equal deleted inserted replaced
24:166664f0f860 25:dd1489098265
42 Handlers handlers_; 42 Handlers handlers_;
43 43
44 typedef std::set<std::string> RegisteredUsers; 44 typedef std::set<std::string> RegisteredUsers;
45 RegisteredUsers registeredUsers_; 45 RegisteredUsers registeredUsers_;
46 46
47 bool authentication_;
47 bool ssl_; 48 bool ssl_;
48 std::string certificate_; 49 std::string certificate_;
49 uint16_t port_; 50 uint16_t port_;
50 51
51 bool IsRunning() const; 52 bool IsRunning() const;
64 65
65 void Start(); 66 void Start();
66 67
67 void Stop(); 68 void Stop();
68 69
70 void ClearUsers();
71
69 void RegisterUser(const char* username, 72 void RegisterUser(const char* username,
70 const char* password); 73 const char* password);
71 74
72 void RegisterHandler(HttpHandler* handler); // This takes the ownership 75 void RegisterHandler(HttpHandler* handler); // This takes the ownership
76
77 bool IsAuthenticationEnabled() const
78 {
79 return authentication_;
80 }
81
82 void SetAuthenticationEnabled(bool enabled);
73 83
74 bool IsSslEnabled() const 84 bool IsSslEnabled() const
75 { 85 {
76 return ssl_; 86 return ssl_;
77 } 87 }
89 99
90 // Can return NULL if no handler is associated to this URI 100 // Can return NULL if no handler is associated to this URI
91 HttpHandler* FindHandler(const UriComponents& forUri) const; 101 HttpHandler* FindHandler(const UriComponents& forUri) const;
92 102
93 ChunkStore& GetChunkStore(); 103 ChunkStore& GetChunkStore();
104
105 bool IsValidBasicHttpAuthentication(const std::string& basic) const;
94 }; 106 };
95 } 107 }