test_for_basic_auth_registry - cpp code small improvement

This commit is contained in:
Ilya Golshtein 2023-05-08 13:29:19 +00:00
parent 83569688cb
commit c1c5ffa309

View File

@ -940,24 +940,19 @@ private:
{
Poco::Net::HTTPCredentials http_credentials;
Poco::Net::HTTPBasicCredentials http_basic_credentials;
std::string decoded_username;
std::string decoded_password;
http_credentials.fromUserInfo(url.getUserInfo());
std::string decoded_username;
Poco::URI::decode(http_credentials.getUsername(), decoded_username);
http_basic_credentials.setUsername(decoded_username);
if (!http_credentials.getPassword().empty())
{
Poco::URI::decode(http_credentials.getUsername(), decoded_username);
std::string decoded_password;
Poco::URI::decode(http_credentials.getPassword(), decoded_password);
http_basic_credentials.setUsername(decoded_username);
http_basic_credentials.setPassword(decoded_password);
}
else
{
Poco::URI::decode(http_credentials.getUsername(), decoded_username);
http_basic_credentials.setUsername(decoded_username);
}
http_basic_credentials.authenticate(request);
}