Wire API auth token stuff.

This commit is contained in:
Adam Ierymenko
2015-04-15 19:14:12 -07:00
parent c301d8e438
commit 21a7e774bb
4 changed files with 46 additions and 21 deletions

View File

@@ -28,12 +28,14 @@
#ifndef ZT_ONE_CONTROLPLANE_HPP
#define ZT_ONE_CONTROLPLANE_HPP
#include "../include/ZeroTierOne.h"
#include <string>
#include <map>
#include <set>
#include "../include/ZeroTierOne.h"
#include "../node/Mutex.hpp"
namespace ZeroTier {
class OneService;
@@ -49,6 +51,15 @@ public:
ControlPlane(OneService *svc,Node *n);
~ControlPlane();
/**
* Add an authentication token for API access
*/
inline void addAuthToken(const char *tok)
{
Mutex::Lock _l(_authTokens_m);
_authTokens.insert(std::string(tok));
}
/**
* Handle HTTP request
*
@@ -74,6 +85,7 @@ private:
OneService *const _svc;
Node *const _node;
std::set<std::string> _authTokens;
Mutex _authTokens_m;
};
} // namespace ZeroTier