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

Function BasicAuth

be/src/rpc/authentication.cc:763–790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763bool BasicAuth(ThriftServer::ConnectionContext* connection_context,
764 const AuthenticationHash& hash, const string& base64) {
765 string username, password;
766 Status status = BasicAuthExtractCredentials(base64, username, password);
767 if (!status.ok()) {
768 LOG(ERROR) << "Error parsing basic authentication token from: "
769 << TNetworkAddressToString(connection_context->network_address)
770 << " Error: " << status;
771 connection_context->return_headers.push_back("WWW-Authenticate: Basic");
772 return false;
773 }
774 bool ret = DoLdapCheck(username.c_str(), password.c_str(), password.length());
775 if (ret) {
776 // Authenication was successful, so set the username on the connection.
777 connection_context->username = username;
778 // Create a cookie to return.
779 connection_context->return_headers.push_back(
780 Substitute("Set-Cookie: $0",
781 GenerateCookie(username, hash, HTTP_AUTH_MECH_LDAP)));
782 if (!FLAGS_test_cookie.empty()) {
783 connection_context->return_headers.push_back(
784 Substitute("Set-Cookie: $0", FLAGS_test_cookie));
785 }
786 return true;
787 }
788 connection_context->return_headers.push_back("WWW-Authenticate: Basic");
789 return false;
790}
791
792bool JWTTokenAuth(ThriftServer::ConnectionContext* connection_context,
793 const AuthenticationHash& hash, const string& token) {

Callers

nothing calls this directly

Calls 9

TNetworkAddressToStringFunction · 0.85
DoLdapCheckFunction · 0.85
SubstituteFunction · 0.85
GenerateCookieFunction · 0.85
push_backMethod · 0.80
okMethod · 0.45
lengthMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected