void Authenticator::updateAuthInfo(http::Request& request) { if (request.has("Authorization")) { const std::string& authorization = request.get("Authorization"); if (isBasicCredentials(authorization)) { BasicAuthenticator(_username, _password).authenticate(request); } // else if (isDigestCredentials(authorization)) // ; // TODO } }
void HTTPCredentials::updateAuthInfo(HTTPRequest& request) { if (request.has(HTTPRequest::AUTHORIZATION)) { const std::string& authorization = request.get(HTTPRequest::AUTHORIZATION); if (isBasicCredentials(authorization)) { HTTPBasicCredentials(_digest.getUsername(), _digest.getPassword()).authenticate(request); } else if (isDigestCredentials(authorization)) { _digest.updateAuthInfo(request); } } }
void Authenticator::authenticate(http::Request& request, const http::Response& response) { for (http::Response::ConstIterator iter = response.find("WWW-Authenticate"); iter != response.end(); ++iter) { if (isBasicCredentials(iter->second)) { BasicAuthenticator(_username, _password).authenticate(request); return; } // else if (isDigestCredentials(iter->second)) // ; // TODO } }
void HTTPCredentials::authenticate(HTTPRequest& request, const HTTPResponse& response) { for (HTTPResponse::ConstIterator iter = response.find("WWW-Authenticate"); iter != response.end(); ++iter) { if (isBasicCredentials(iter->second)) { HTTPBasicCredentials(_digest.getUsername(), _digest.getPassword()).authenticate(request); return; } else if (isDigestCredentials(iter->second)) { _digest.authenticate(request, HTTPAuthenticationParams(iter->second.substr(7))); return; } } }
bool hasProxyBasicCredentials(const http::Request& request) { return request.has("Proxy-Authorization") && isBasicCredentials(request.get("Proxy-Authorization")); }
bool HTTPCredentials::hasBasicCredentials(const HTTPRequest& request) { return request.has(HTTPRequest::AUTHORIZATION) && isBasicCredentials(request.get(HTTPRequest::AUTHORIZATION)); }