summaryrefslogtreecommitdiffstats
path: root/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client/Authenticators/ChallengeResponseAuthenticator.cpp')
-rw-r--r--src/Client/Authenticators/ChallengeResponseAuthenticator.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp b/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp
index 4aadb63..7ccaa63 100644
--- a/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp
+++ b/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp
@@ -40,7 +40,7 @@ void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::sendRequest()
void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::handlePacket(boost::shared_ptr<const Common::XmlData> packet) {
if(packet->getType() == "Error") {
- signalFinished(Core::Exception(packet->get<const std::string&>("Where"), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")),
+ signalFinished(Core::Exception(packet->get<const Core::String&>("Where").extract(), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")),
packet->get<long>("SubCode"), packet->get<long>("SubSubCode")));
return;
}
@@ -58,7 +58,7 @@ void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::handlePacket(
ret.set("user", username);
- std::vector<boost::uint8_t> hashedPassword = Common::Hash::hash(std::vector<boost::uint8_t>(password.begin(), password.end()), hash);
+ std::vector<boost::uint8_t> hashedPassword = Common::Hash::hash(password, hash);
const std::vector<boost::uint8_t> &challenge = packet->get<const std::vector<boost::uint8_t>&>("data");
hashedPassword.insert(hashedPassword.end(), challenge.begin(), challenge.end());
@@ -79,8 +79,8 @@ void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::handlePacket(
}
}
-void ChallengeResponseAuthenticator::authenticate(Common::Application *application, Common::Connection *con, const std::string &username, const std::string &password) throw (Core::Exception) {
- std::string hash;
+void ChallengeResponseAuthenticator::authenticate(Common::Application *application, Common::Connection *con, const Core::String &username, const Core::String &password) throw (Core::Exception) {
+ Core::String hash;
{
boost::shared_ptr<Common::Requests::AuthMethodRequest> request(new Common::Requests::AuthMethodRequest(application));
@@ -96,14 +96,14 @@ void ChallengeResponseAuthenticator::authenticate(Common::Application *applicati
const Common::XmlData::List *methods = result.first->getList("methods");
for(Common::XmlData::List::const_iterator method = methods->begin(); method != methods->end(); ++method) {
- if(method->get<const std::string&>("name") != "Challenge-Response")
+ if(method->get<const Core::String&>("name") != "Challenge-Response")
continue;
const Common::XmlData::List *subMethods = method->getList("subMethods");
for(Common::XmlData::List::const_iterator subMethod = subMethods->begin(); subMethod != subMethods->end(); ++subMethod) {
- if(Common::Hash::isHashSupported(subMethod->get<const std::string&>("name"))) {
- hash = subMethod->get<const std::string&>("name");
+ if(Common::Hash::isHashSupported(subMethod->get<const Core::String&>("name"))) {
+ hash = subMethod->get<const Core::String&>("name");
break;
}
}
@@ -111,11 +111,11 @@ void ChallengeResponseAuthenticator::authenticate(Common::Application *applicati
break;
}
- if(hash.empty())
+ if(hash.isEmpty())
throw Core::Exception(Core::Exception::NOT_AVAILABLE);
}
- application->logf(Core::Logger::LOG_VERBOSE, "Authenticating with method 'Challenge-Response' using hash '%s'...", hash.c_str());
+ application->logf(Core::Logger::LOG_VERBOSE, "Authenticating with method 'Challenge-Response' using hash '%s'...", hash.extract().c_str());
boost::shared_ptr<ChallengeResponseAuthRequest> request(new ChallengeResponseAuthRequest(application, username, password, hash));