@Test public void testDefaults() { final KMSACLs acls = new KMSACLs(new Configuration(false)); for (Type type : Type.values()) { Assert.assertTrue(acls.hasAccess(type, UserGroupInformation.createRemoteUser("foo"), ipAddress)); } }
@Override public boolean hasAccess(Type type, UserGroupInformation ugi, String clientIp) { boolean access = acls.get(type).isUserAllowed(ugi); if (LOG.isDebugEnabled()) { LOG.debug("Checking user [{}] for: {} {} ", ugi.getShortUserName(), type.toString(), acls.get(type).getAclString()); } if (access) { AccessControlList blacklist = blacklistedAcls.get(type); access = (blacklist == null) || !blacklist.isUserInList(ugi); if (LOG.isDebugEnabled()) { if (blacklist == null) { LOG.debug("No blacklist for {}", type.toString()); } else if (access) { LOG.debug("user is in {}" , blacklist.getAclString()); } else { LOG.debug("user is not in {}" , blacklist.getAclString()); } } } if (LOG.isDebugEnabled()) { LOG.debug("User: [{}], Type: {} Result: {}", ugi.getShortUserName(), type.toString(), access); } return access; }
KMSACLs implements Runnable, KeyACLs { @Override public boolean hasAccess(Type type, UserGroupInformation ugi, String clientIp) { boolean access = acls.get(type).isUserAllowed(ugi); if (LOG.isDebugEnabled()) { LOG.debug("Checking user [{}] for: {} {} ", ugi.getShortUserName(), type.toString(), acls.get(type).getAclString()); } if (access) { AccessControlList blacklist = blacklistedAcls.get(type); access = (blacklist == null) || !blacklist.isUserInList(ugi); if (LOG.isDebugEnabled()) { if (blacklist == null) { LOG.debug("No blacklist for {}", type.toString()); } else if (access) { LOG.debug("user is in {}" , blacklist.getAclString()); } else { LOG.debug("user is not in {}" , blacklist.getAclString()); } } } if (LOG.isDebugEnabled()) { LOG.debug("User: [{}], Type: {} Result: {}", ugi.getShortUserName(), type.toString(), access); } return access; } }
KMSACLs implements Runnable, KeyACLs { @Override public boolean hasAccess(Type type, UserGroupInformation ugi, String clientIp) { boolean access = acls.get(type).isUserAllowed(ugi); if (LOG.isDebugEnabled()) { LOG.debug("Checking user [{}] for: {} {} ", ugi.getShortUserName(), type.toString(), acls.get(type).getAclString()); } if (access) { AccessControlList blacklist = blacklistedAcls.get(type); access = (blacklist == null) || !blacklist.isUserInList(ugi); if (LOG.isDebugEnabled()) { if (blacklist == null) { LOG.debug("No blacklist for {}", type.toString()); } else if (access) { LOG.debug("user is in {}" , blacklist.getAclString()); } else { LOG.debug("user is not in {}" , blacklist.getAclString()); } } } if (LOG.isDebugEnabled()) { LOG.debug("User: [{}], Type: {} Result: {}", ugi.getShortUserName(), type.toString(), access); } return access; } KMSACLs(Configuration conf);  KMSACLs(); }
KMSACLs implements Runnable, KeyACLs { @Override public boolean hasAccess(Type type, UserGroupInformation ugi, String clientIp) { boolean access = acls.get(type).isUserAllowed(ugi); if (LOG.isDebugEnabled()) { LOG.debug("Checking user [{}] for: {} {} ", ugi.getShortUserName(), type.toString(), acls.get(type).getAclString()); } if (access) { AccessControlList blacklist = blacklistedAcls.get(type); access = (blacklist == null) || !blacklist.isUserInList(ugi); if (LOG.isDebugEnabled()) { if (blacklist == null) { LOG.debug("No blacklist for {}", type.toString()); } else if (access) { LOG.debug("user is in {}" , blacklist.getAclString()); } else { LOG.debug("user is not in {}" , blacklist.getAclString()); } } } if (LOG.isDebugEnabled()) { LOG.debug("User: [{}], Type: {} Result: {}", ugi.getShortUserName(), type.toString(), access); } return access; } KMSACLs(Configuration conf);  KMSACLs(); @Override void run(); @Override synchronized void startReloader(); @Override synchronized void stopReloader(); @Override boolean hasAccess(Type type, UserGroupInformation ugi, String clientIp); @Override void assertAccess(Type aclType,
      UserGroupInformation ugi, KMSOp operation, String key, String clientIp); @Override boolean hasAccessToKey(String keyName, UserGroupInformation ugi,
      KeyOpType opType); @Override boolean isACLPresent(String keyName, KeyOpType opType); }
KMSACLs implements Runnable, KeyACLs { @Override public boolean hasAccess(Type type, UserGroupInformation ugi, String clientIp) { boolean access = acls.get(type).isUserAllowed(ugi); if (LOG.isDebugEnabled()) { LOG.debug("Checking user [{}] for: {} {} ", ugi.getShortUserName(), type.toString(), acls.get(type).getAclString()); } if (access) { AccessControlList blacklist = blacklistedAcls.get(type); access = (blacklist == null) || !blacklist.isUserInList(ugi); if (LOG.isDebugEnabled()) { if (blacklist == null) { LOG.debug("No blacklist for {}", type.toString()); } else if (access) { LOG.debug("user is in {}" , blacklist.getAclString()); } else { LOG.debug("user is not in {}" , blacklist.getAclString()); } } } if (LOG.isDebugEnabled()) { LOG.debug("User: [{}], Type: {} Result: {}", ugi.getShortUserName(), type.toString(), access); } return access; } KMSACLs(Configuration conf);  KMSACLs(); @Override void run(); @Override synchronized void startReloader(); @Override synchronized void stopReloader(); @Override boolean hasAccess(Type type, UserGroupInformation ugi, String clientIp); @Override void assertAccess(Type aclType,
      UserGroupInformation ugi, KMSOp operation, String key, String clientIp); @Override boolean hasAccessToKey(String keyName, UserGroupInformation ugi,
      KeyOpType opType); @Override boolean isACLPresent(String keyName, KeyOpType opType); static final String ACL_DEFAULT; static final int RELOADER_SLEEP_MILLIS; }