Wire API auth token stuff.
This commit is contained in:
parent
c301d8e438
commit
21a7e774bb
4 changed files with 46 additions and 21 deletions
|
@ -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) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue