1
0
Fork 0

fix authentication

This commit is contained in:
Jan Christoph Uhde 2016-09-09 11:43:07 +02:00
parent e230e3e2c5
commit 6fa320299e
1 changed files with 3 additions and 3 deletions

View File

@ -240,15 +240,15 @@ bool VppCommTask::processRead() {
if (type == 1000) {
// do authentication
std::string encryption = header.at(2).copyString();
std::string user = header.at(2).copyString();
std::string pass = header.at(3).copyString();
std::string user = header.at(3).copyString();
std::string pass = header.at(4).copyString();
auto auth = basics::StringUtils::encodeBase64(user + ":" + pass);
AuthResult result = GeneralServerFeature::AUTH_INFO.checkAuthentication(
AuthInfo::AuthType::BASIC, auth);
if (result._authorized) {
_authenticatedUser = std::move(user);
handleSimpleError(rest::ResponseCode::I_AM_A_TEAPOT, TRI_ERROR_NO_ERROR,
handleSimpleError(rest::ResponseCode::OK, TRI_ERROR_NO_ERROR,
"authentication successful", chunkHeader._messageID);
} else {
_authenticatedUser.clear();