mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 10:24:26 +01:00
Removed authenticated feature. Authentication is now required
This commit is contained in:
parent
c8dccd7bfc
commit
f99ed93f29
@ -61,7 +61,6 @@ Logic::Response Logic::parseRequest(const string &str)
|
||||
Json::Value root;
|
||||
Response retval = Fail;
|
||||
string action, user, password, ip, token;
|
||||
bool authenticate;
|
||||
|
||||
bool suc = reader.parse(str, root, false);
|
||||
if (!suc)
|
||||
@ -74,14 +73,10 @@ Logic::Response Logic::parseRequest(const string &str)
|
||||
try {
|
||||
action = getJsonOrFail<string>(root, "action");
|
||||
ip = getJsonOrFail<string>(root, "ip");
|
||||
authenticate = getJsonOrFail<bool>(root, "authenticate");
|
||||
if (authenticate == true)
|
||||
{
|
||||
user = getJsonOrFail<string>(root, "user");
|
||||
password = getJsonOrFail<string>(root, "password");
|
||||
token = getJsonOrFail<string>(root, "token");
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
_logger(LogLevel::warning, "Error parsing JSON");
|
||||
@ -94,8 +89,6 @@ Logic::Response Logic::parseRequest(const string &str)
|
||||
_logger(" IP : " + ip, LogLevel::notice);
|
||||
_logger(" Token : " + token, LogLevel::notice);
|
||||
|
||||
if (authenticate == true)
|
||||
{
|
||||
if (_checkToken(token) == false)
|
||||
{
|
||||
_logger(LogLevel::error, "User provided invalid token");
|
||||
@ -109,14 +102,6 @@ Logic::Response Logic::parseRequest(const string &str)
|
||||
_logger(LogLevel::error, "Ldap error");
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
if (_checkIP(ip) == false)
|
||||
{
|
||||
_logger(LogLevel::error, "IP check for non-authentication failed");
|
||||
retval = InvalidIP;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == "lock")
|
||||
{
|
||||
@ -163,11 +148,6 @@ Logic::Response Logic::_unlock()
|
||||
return Success;
|
||||
}
|
||||
|
||||
bool Logic::_checkIP(const string &ip)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Logic::_checkToken(const string &strToken)
|
||||
{
|
||||
try {
|
||||
|
@ -47,8 +47,6 @@ private:
|
||||
bool _checkToken(const std::string &token);
|
||||
Response _checkLDAP(const std::string &user,
|
||||
const std::string &password);
|
||||
bool _checkIP(const std::string &ip);
|
||||
|
||||
void _createNewToken(const bool stillValid);
|
||||
|
||||
const Logger &_logger;
|
||||
|
Loading…
Reference in New Issue
Block a user