Wire API auth token stuff.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user