I'd like to set a Basic Authentication with cppRest-sdk AKA casablanca for the security configuration to elastic-search cluster.
I've tried to do with header configuration such as following and it worked fine.
http_client client(U("http://serverip:9200/"));
http_request req(methods::GET);
req.headers().add(L"Authorization", L"Basic ZWxhc3RpYzpwYXNzd29yZA==");
But I want to use cppRest-sdk's credentials configuration class such as these codes.
http_client_config client_config;
web::credentials cred(U("elastic"), U("password"));
client_config.set_credentials(cred);
http_client client(U("http://serverip:9200/"), client_config);
I've debugged as much as I could but elastic-search cluster repeatly returns 401 error such as below.
Resuest result :401{"error":{"header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""},"reason":"missing authentication credentials for REST request [/]","root_cause":[{"header":{"WWW-Authenticate":"Basic realm="security" charset="UTF-8""},"reason":"missing authentication credentials for REST request [/]","type":"security_exception"}],"type":"security_exception"},"status":401}
I've been searching for a quite long time but I couldn't find adequate answer because of lack of information of cppRest-SDK.
Any advice would greatly appreciated.
Thank you.