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

Function BasicAuthExtractCredentials

be/src/rpc/authentication-util.cc:237–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237Status BasicAuthExtractCredentials(
238 const string& token, string& username, string& password) {
239 if (token.empty()) {
240 return Status::Expected("Empty token");
241 }
242 string decoded;
243 if (!Base64Unescape(token, &decoded)) {
244 return Status::Expected("Failed to decode base64 basic authentication token.");
245 }
246 std::size_t colon = decoded.find(':');
247 if (colon == std::string::npos) {
248 return Status::Expected("Invalid basic authentication token format, must be in the "
249 "form '<username>:<password>'");
250 }
251 username = decoded.substr(0, colon);
252 password = decoded.substr(colon + 1);
253 return Status::OK();
254}
255
256} // namespace impala

Callers 4

BasicAuthFunction · 0.85
HandleBasicMethod · 0.85

Calls 5

OKFunction · 0.85
substrMethod · 0.80
Base64UnescapeFunction · 0.50
emptyMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected