HBASE-17728 Create separate build target for Configuration classes
diff --git a/core/BUCK b/core/BUCK index e40236f..fd4c0dc 100644 --- a/core/BUCK +++ b/core/BUCK
@@ -33,8 +33,6 @@ "meta-utils.h", "get.h", "time-range.h", - "configuration.h", - "hbase-configuration-loader.h", "scan.h", "result.h", "request-converter.h", @@ -52,8 +50,6 @@ "meta-utils.cc", "get.cc", "time-range.cc", - "configuration.cc", - "hbase-configuration-loader.cc", "scan.cc", "result.cc", "request-converter.cc", @@ -64,6 +60,7 @@ "//exceptions:exceptions", "//utils:utils", "//connection:connection", + "//core:conf", "//if:if", "//serde:serde", "//third-party:folly", @@ -74,6 +71,21 @@ visibility=[ 'PUBLIC', ],) +cxx_library( + name="conf", + exported_headers=[ + "configuration.h", + "hbase-configuration-loader.h", + ], + srcs=[ + "configuration.cc", + "hbase-configuration-loader.cc", + ], + deps=["//third-party:folly"], + compiler_flags=['-Weffc++', '-ggdb'], + visibility=[ + 'PUBLIC', + ],) cxx_test( name="location-cache-test", srcs=[
diff --git a/security/BUCK b/security/BUCK index d602ff3..1199797 100644 --- a/security/BUCK +++ b/security/BUCK
@@ -23,6 +23,6 @@ "user.h", ], srcs=[], - deps=[], + deps=["//core:conf"], compiler_flags=['-Weffc++'], visibility=['//core/...', '//connection/...'],)
diff --git a/security/user.h b/security/user.h index 8a15891..372ab44 100644 --- a/security/user.h +++ b/security/user.h
@@ -18,10 +18,13 @@ */ #pragma once +#include <mutex> #include <string> +#include "core/configuration.h" namespace hbase { namespace security { +static constexpr const char* kKerberos = "kerberos"; class User { public: explicit User(const std::string& user_name) : user_name_(user_name) {} @@ -31,6 +34,9 @@ static std::shared_ptr<User> defaultUser() { return std::make_shared<User>("__drwho"); } + static bool IsSecurityEnabled(const Configuration& conf) { + return conf.Get("hbase.security.authentication", "").compare(kKerberos) == 0; + } private: std::string user_name_; };