Optional attributes:
+* *bearer-token*: Bearer token used to authorize the HTTP requests.
* *connect-timeout*: Timeout (in ms) for network connection. The default is 100.
* *keep-alive*: If *true*, keep the HTTP connection to the storage server open
to avoid reconnects. The default is *true*.
auto operation_timeout = k_default_operation_timeout;
for (const auto& attr : params.attributes) {
- if (attr.key == "connect-timeout") {
+ if (attr.key == "bearer-token") {
+ m_http_client.set_bearer_token_auth(attr.value.c_str());
+ } else if (attr.key == "connect-timeout") {
connect_timeout = parse_timeout_attribute(attr.value);
} else if (attr.key == "keep-alive") {
m_http_client.set_keep_alive(attr.value == "true");
if (user_info.second) {
url.user_info(FMT("{}:{}", user_info.first, k_redacted_password));
}
+
+ auto bearer_token_attribute =
+ std::find_if(params.attributes.begin(),
+ params.attributes.end(),
+ [&](const auto& attr) { return attr.key == "bearer-token"; });
+ if (bearer_token_attribute != params.attributes.end()) {
+ bearer_token_attribute->value = k_redacted_password;
+ bearer_token_attribute->raw_value = k_redacted_password;
+ }
}
} // namespace secondary