diff --git a/hbase-native-client/core/BUCK b/hbase-native-client/core/BUCK index e40236f..fd4c0dc 100644 --- a/hbase-native-client/core/BUCK +++ b/hbase-native-client/core/BUCK @@ -33,8 +33,6 @@ cxx_library( "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 @@ cxx_library( "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 @@ cxx_library( "//exceptions:exceptions", "//utils:utils", "//connection:connection", + "//core:conf", "//if:if", "//serde:serde", "//third-party:folly", @@ -74,6 +71,21 @@ cxx_library( 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/hbase-native-client/security/BUCK b/hbase-native-client/security/BUCK index d602ff3..1199797 100644 --- a/hbase-native-client/security/BUCK +++ b/hbase-native-client/security/BUCK @@ -23,6 +23,6 @@ cxx_library( "user.h", ], srcs=[], - deps=[], + deps=["//core:conf"], compiler_flags=['-Weffc++'], visibility=['//core/...', '//connection/...'],) diff --git a/hbase-native-client/security/user.h b/hbase-native-client/security/user.h index 8a15891..e135476 100644 --- a/hbase-native-client/security/user.h +++ b/hbase-native-client/security/user.h @@ -18,10 +18,13 @@ */ #pragma once +#include #include +#include "core/configuration.h" namespace hbase { namespace security { +static constexpr const char* KERBEROS = "kerberos"; class User { public: explicit User(const std::string& user_name) : user_name_(user_name) {} @@ -31,6 +34,9 @@ class User { static std::shared_ptr defaultUser() { return std::make_shared("__drwho"); } + static bool isSecurityEnabled(const Configuration& conf) { + return conf.Get("hbase.security.authentication", "").compare(KERBEROS) == 0; + } private: std::string user_name_; };