1 #include "krb-name-mapper.h"
5 #include <boost/foreach.hpp>
8 using namespace impala;
12 int main(
int argc,
char** argv) {
14 rules.push_back(
"RULE:[1:$1@$0](.*@YAHOO\\.COM)s/@.*//");
15 rules.push_back(
"RULE:[2:$1](johndoe)s/^.*$/guest/");
16 rules.push_back(
"RULE:[2:$1;$2](^.*;admin$)s/;admin$//");
17 rules.push_back(
"RULE:[2:$2](root)");
18 rules.push_back(
"DEFAULT");
20 FLAGS_kerberos_default_realm =
"CLOUDERA.COM";
21 KrbNameMapper k(rules);
22 vector<string> principals;
23 principals.push_back(
"omalley@CLOUDERA.COM");
24 principals.push_back(
"hdfs/10.0.0.1@CLOUDERA.COM");
25 principals.push_back(
"johndoe/zoo@FOO.COM");
26 principals.push_back(
"joe/admin@FOO.COM");
27 principals.push_back(
"joe/root@FOO.COM");
29 BOOST_FOREACH(
const string& principal, principals) {
31 if (k.PrincipalToLocal(principal, &out)) {
32 LOG(INFO) <<
"Mapped: " << principal <<
" to: " << out;
34 LOG(INFO) <<
"Mapping for: " << principal <<
" failed!";
int main(int argc, char **argv)