MCPcopy Create free account
hub / github.com/apache/impala / HandleBasic

Method HandleBasic

be/src/util/webserver.cc:1220–1245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1218}
1219
1220Status Webserver::HandleBasic(struct sq_connection* connection,
1221 struct sq_request_info* request_info, vector<string>* response_headers) {
1222 const char* authz_header = sq_get_header(connection, "Authorization");
1223 if (!authz_header) {
1224 return Status::Expected("No Authorization header provided.");
1225 }
1226
1227 string base64;
1228 if (!TryStripPrefixString(authz_header, "Basic ", &base64)) {
1229 return Status::Expected("No Basic authentication provided.");
1230 }
1231 string username, password;
1232 Status status = BasicAuthExtractCredentials(base64, username, password);
1233 if (!status.ok()) {
1234 LOG(ERROR) << "Error parsing basic authentication token from: "
1235 << GetRemoteAddress(request_info).ToString() << " Error: " << status;
1236 return status;
1237 }
1238 if (ldap_->LdapCheckPass(username.c_str(), password.c_str(), password.length())
1239 && ldap_->LdapCheckFilters(username)) {
1240 request_info->remote_user = strdup(username.c_str());
1241 return Status::OK();
1242 }
1243
1244 return Status::Expected("Failed to authenticate to LDAP.");
1245}
1246
1247void Webserver::AddCookie(const char* user, vector<string>* response_headers,
1248 const string& authMech, string* cookie_rand_value) {

Callers

nothing calls this directly

Calls 9

TryStripPrefixStringFunction · 0.85
GetRemoteAddressFunction · 0.85
OKFunction · 0.85
okMethod · 0.45
ToStringMethod · 0.45
LdapCheckPassMethod · 0.45
lengthMethod · 0.45
LdapCheckFiltersMethod · 0.45

Tested by

no test coverage detected