Fixing MFA UUID issue.

This commit is contained in:
stephb9959
2021-11-12 08:20:16 -08:00
parent 9095d831db
commit 12fddd8bc4
3 changed files with 1 additions and 18 deletions

View File

@@ -66,28 +66,22 @@ namespace OpenWifi {
bool MFAServer::CompleteMFAChallenge(Poco::JSON::Object::Ptr &ChallengeResponse, SecurityObjects::UserInfoAndPolicy &UInfo) {
std::lock_guard G(Mutex_);
std::cout << __func__ << ":" << __LINE__ << std::endl;
if(!ChallengeResponse->has("uuid") || !ChallengeResponse->has("answer"))
return false;
auto uuid = ChallengeResponse->get("uuid").toString();
auto Hint = Cache_.find(uuid);
std::cout << __func__ << ":" << __LINE__ << "UUID:" << uuid << std::endl;
if(Hint == end(Cache_)) {
std::cout << __func__ << ":" << __LINE__ << std::endl;
return false;
}
auto answer = ChallengeResponse->get("answer").toString();
std::cout << __func__ << ":" << __LINE__ << Hint->second.Answer << " == " << answer << std::endl;
if(Hint->second.Answer!=answer) {
std::cout << __func__ << ":" << __LINE__ << std::endl;
return false;
}
UInfo = Hint->second.UInfo;
Cache_.erase(Hint);
std::cout << __func__ << ":" << __LINE__ << std::endl;
return true;
}