in src/authentication/adfs/adfs.cc [173:207]
std::string AdfsCredentialsProvider::get_form_action_body(std::string& url, std::map<std::string, std::string>& params) {
if (!validate_url(url)) {
return "";
}
std::shared_ptr< Aws::Http::HttpRequest > req = Aws::Http::CreateHttpRequest(url, Aws::Http::HttpMethod::HTTP_POST, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
// set content
std::string body;
for (auto& itr : params) {
body += itr.first + "=" + itr.second;
body += "&";
}
body.pop_back();
std::shared_ptr< Aws::StringStream > ss = std::make_shared< Aws::StringStream >();
*ss << body;
req->AddContentBody(ss);
req->SetContentLength(std::to_string(body.size()));
// check response code
std::shared_ptr< Aws::Http::HttpResponse > response = http_client->MakeRequest(req);
if (response->GetResponseCode() != Aws::Http::HttpResponseCode::OK) {
LOG(WARNING) << "ADFS request returned bad HTTP response code: " << response->GetResponseCode();
if (response->HasClientError()) {
LOG(WARNING) << "HTTP Client Error: " << response->GetClientErrorMessage();
}
return "";
}
std::istreambuf_iterator< char > eos;
std::string resp_body(std::istreambuf_iterator< char >(response->GetResponseBody().rdbuf()), eos);
return resp_body;
}