summaryrefslogtreecommitdiff
path: root/service/ControlPlane.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-15 19:14:12 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-15 19:14:12 -0700
commit21a7e774bba4832848687dbd8d2e0a1df33650ce (patch)
treef7258ed063b0fca601e33f7f49417f42f95b9600 /service/ControlPlane.cpp
parentc301d8e43859066155801b44b9953d38e3e36d03 (diff)
downloadinfinitytier-21a7e774bba4832848687dbd8d2e0a1df33650ce.tar.gz
infinitytier-21a7e774bba4832848687dbd8d2e0a1df33650ce.zip
Wire API auth token stuff.
Diffstat (limited to 'service/ControlPlane.cpp')
-rw-r--r--service/ControlPlane.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/service/ControlPlane.cpp b/service/ControlPlane.cpp
index 3d37a90a..8957e344 100644
--- a/service/ControlPlane.cpp
+++ b/service/ControlPlane.cpp
@@ -248,7 +248,18 @@ unsigned int ControlPlane::handleRequest(
ps.push_back(std::string("index.html"));
}
- bool isAuth = true; // TODO: auth tokens
+ bool isAuth = false;
+ {
+ Mutex::Lock _l(_authTokens_m);
+ std::map<std::string,std::string>::const_iterator ah(headers.find("x-zt1-auth"));
+ if ((ah != headers.end())&&(_authTokens.count(ah->second) > 0))
+ isAuth = true;
+ else {
+ ah = urlArgs.find("auth");
+ if ((ah != urlArgs.end())&&(_authTokens.count(ah->second) > 0))
+ isAuth = true;
+ }
+ }
if (httpMethod == HTTP_GET) {