use of org.apache.hadoop.crypto.key.kms.server.KMSACLsType.Type in project ranger by apache.
the class RangerKMSAccessRequest method setKMSACLs.
private void setKMSACLs(Configuration conf) {
Map<Type, AccessControlList> tempBlacklist = new HashMap<Type, AccessControlList>();
for (Type aclType : Type.values()) {
String blacklistStr = conf.get(aclType.getBlacklistConfigKey());
if (blacklistStr != null) {
// Only add if blacklist is present
tempBlacklist.put(aclType, new AccessControlList(blacklistStr));
LOG.info("'{}' Blacklist '{}'", aclType, blacklistStr);
}
}
blacklistedAcls = tempBlacklist;
}
use of org.apache.hadoop.crypto.key.kms.server.KMSACLsType.Type in project ranger by apache.
the class TestKMSACLs method testCustom.
@Test
public void testCustom() {
final Configuration conf = new Configuration(false);
for (Type type : Type.values()) {
conf.set(type.getAclConfigKey(), type.toString() + " ");
}
final KMSACLs acls = new KMSACLs(conf);
for (Type type : Type.values()) {
Assert.assertTrue(acls.hasAccess(type, UserGroupInformation.createRemoteUser(type.toString()), ipAddress));
Assert.assertFalse(acls.hasAccess(type, UserGroupInformation.createRemoteUser("foo"), ipAddress));
}
}
use of org.apache.hadoop.crypto.key.kms.server.KMSACLsType.Type in project ranger by apache.
the class KMSACLs method setKMSACLs.
private void setKMSACLs(Configuration conf) {
Map<Type, AccessControlList> tempAcls = new HashMap<Type, AccessControlList>();
Map<Type, AccessControlList> tempBlacklist = new HashMap<Type, AccessControlList>();
for (Type aclType : Type.values()) {
String aclStr = conf.get(aclType.getAclConfigKey(), ACL_DEFAULT);
tempAcls.put(aclType, new AccessControlList(aclStr));
String blacklistStr = conf.get(aclType.getBlacklistConfigKey());
if (blacklistStr != null) {
// Only add if blacklist is present
tempBlacklist.put(aclType, new AccessControlList(blacklistStr));
LOG.info("'{}' Blacklist '{}'", aclType, blacklistStr);
}
LOG.info("'{}' ACL '{}'", aclType, aclStr);
}
acls = tempAcls;
blacklistedAcls = tempBlacklist;
}
Aggregations