1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.security;
19
20 import org.apache.hadoop.conf.Configuration;
21 import org.apache.hadoop.hbase.ipc.HMasterInterface;
22 import org.apache.hadoop.hbase.ipc.HMasterRegionInterface;
23 import org.apache.hadoop.hbase.ipc.HRegionInterface;
24 import org.apache.hadoop.security.authorize.PolicyProvider;
25 import org.apache.hadoop.security.authorize.Service;
26 import org.apache.hadoop.security.authorize.ServiceAuthorizationManager;
27
28
29
30
31
32 public class HBasePolicyProvider extends PolicyProvider {
33 protected static Service[] services = {
34 new Service("security.client.protocol.acl", HRegionInterface.class),
35 new Service("security.admin.protocol.acl", HMasterInterface.class),
36 new Service("security.masterregion.protocol.acl", HMasterRegionInterface.class)
37 };
38
39 @Override
40 public Service[] getServices() {
41 return services;
42 }
43
44 public static void init(Configuration conf,
45 ServiceAuthorizationManager authManager) {
46
47 System.setProperty("hadoop.policy.file", "hbase-policy.xml");
48 if (conf.getBoolean(
49 ServiceAuthorizationManager.SERVICE_AUTHORIZATION_CONFIG, false)) {
50 authManager.refresh(conf, new HBasePolicyProvider());
51 }
52 }
53 }