You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zg...@apache.org on 2019/03/12 12:45:57 UTC
[hbase] 69/133: HBASE-17728 Create separate build target for
Configuration classes
This is an automated email from the ASF dual-hosted git repository.
zghao pushed a commit to branch HBASE-14850
in repository https://gitbox.apache.org/repos/asf/hbase.git
commit d4d079c8c277f7e206924361db68a72ac9f6d3a0
Author: tedyu <yu...@gmail.com>
AuthorDate: Wed Mar 8 12:11:57 2017 -0800
HBASE-17728 Create separate build target for Configuration classes
---
hbase-native-client/core/BUCK | 20 ++++++++++++++++----
hbase-native-client/security/BUCK | 2 +-
hbase-native-client/security/user.h | 6 ++++++
3 files changed, 23 insertions(+), 5 deletions(-)
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..372ab44 100644
--- a/hbase-native-client/security/user.h
+++ b/hbase-native-client/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 @@ class User {
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_;
};