C API for impersonation
libMapRClient
also includes a new function in the
connection.h
header file: hb_connection_create_as_user()
.
This function provides support for impersonation, so that you can connect to a MapR cluster
and access MapR-DB tables by using a specific username.
/**
* Creates an hb_connection_t instance for a specific user and initializes its
* address into the passed pointer.
*/
HBASE_API int32_t
hb_connection_create_as_user(
const char *zk_quorum, /* [in] NULL terminated, comma separated
* string of CLDB servers. e.g.
* "<server1[:port]>,...". If set to
* NULL, IP addresses for CLDB nodes will be
* taken from mapr-clusters.conf */
const char *zk_root, /* [in] Ignored for MapR-DB. */
const char *user, /* [in] The user who is being
* impersonated */
hb_connection_t *connection_ptr); /* [out] pointer to hb_connection_t */
The user that is passed with the hb_connection_create_as_user()
API must
have permissions on the tables that the application accesses. For example, to read from a
table, the user must have the readperm
permission. To write to a table, the
user must have the writeperm
permission. See Enabling Table Authorizations with Access Control Expressions.
For hb_connection_create()
and
hb_connection_create_as_user()
, the standard C APIs for HBase require a
list of ZooKeeper nodes. For MapR-DB, this list is interpreted as a list of CLDB nodes. The
zk_root
parameter is ignored. If zk_quorum
is NULL, then
the connection will be created to the default cluster that is listed in the
mapr-clusters.conf
file.