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

Function GetUsernameFromBasicAuthHeader

be/src/rpc/authentication.cc:691–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689}
690
691static bool GetUsernameFromBasicAuthHeader(
692 ThriftServer::ConnectionContext* connection_context, string auth_header) {
693 string stripped_basic_auth_token;
694 StripWhiteSpace(&auth_header);
695 bool got_basic_auth =
696 TryStripPrefixString(auth_header, "Basic ", &stripped_basic_auth_token);
697 string basic_auth_token = got_basic_auth ? move(stripped_basic_auth_token) : "";
698 string username, password;
699 Status status = BasicAuthExtractCredentials(basic_auth_token, username, password);
700 if (!status.ok()) {
701 LOG(ERROR) << "Error parsing basic authentication token from: "
702 << TNetworkAddressToString(connection_context->network_address)
703 << " Error: " << status;
704 return false;
705 }
706 connection_context->username = username;
707 return true;
708}
709
710bool SetOrigin(
711 ThriftServer::ConnectionContext* connection_context, const std::string& origin) {

Callers 2

TrustedDomainCheckFunction · 0.85
HandleTrustedAuthHeaderFunction · 0.85

Calls 6

TryStripPrefixStringFunction · 0.85
moveFunction · 0.85
TNetworkAddressToStringFunction · 0.85
StripWhiteSpaceFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected