@Override public void validatePolicy(boolean strictValidation) throws SentryConfigurationException { throw new SentryConfigurationException("Not implemented yet"); }
@Override public void validatePolicy(boolean strictValidation) throws SentryConfigurationException { if (!initialized) { throw new IllegalStateException("Backend has not been properly initialized"); } List<String> localConfigErrors = Lists.newArrayList(configErrors); List<String> localConfigWarnings = Lists.newArrayList(configWarnings); if (strictValidation && !localConfigWarnings.isEmpty() || !localConfigErrors.isEmpty()) { localConfigErrors.add("Failed to process global policy file " + resourcePath); SentryConfigurationException e = new SentryConfigurationException(""); e.setConfigErrors(localConfigErrors); e.setConfigWarnings(localConfigWarnings); throw e; } }
@Override public void validate(PrivilegeValidatorContext context) throws SentryConfigurationException { String privilege = context.getPrivilege(); Iterable<IndexerModelAuthorizable> authorizables = parsePrivilege(privilege); boolean foundIndexerInAuthorizables = false; for(IndexerModelAuthorizable authorizable : authorizables) { if(authorizable instanceof Indexer) { foundIndexerInAuthorizables = true; break; } } if(!foundIndexerInAuthorizables) { String msg = "Missing indexer object in " + privilege; throw new SentryConfigurationException(msg); } } }
@Override public void validate(PrivilegeValidatorContext context) throws SentryConfigurationException { String privilege = context.getPrivilege(); Iterable<SearchModelAuthorizable> authorizables = parsePrivilege(privilege); boolean foundCollectionInAuthorizables = false; for(SearchModelAuthorizable authorizable : authorizables) { if(authorizable instanceof Collection) { foundCollectionInAuthorizables = true; break; } } if(!foundCollectionInAuthorizables) { String msg = "Missing collection object in " + privilege; throw new SentryConfigurationException(msg); } } }
configErrors.add("Failed to read policy file " + resourcePath + " Error: " + e.getMessage()); throw new SentryConfigurationException("Error loading policy file " + resourcePath, e); } catch (IllegalArgumentException e) { configErrors.add("Failed to read policy file " + resourcePath + " Error: " + e.getMessage()); throw new SentryConfigurationException("Error loading policy file " + resourcePath, e); } else if (!allowPerDatabaseSection) { String msg = "Per-db policy file is not expected in this configuration."; throw new SentryConfigurationException(msg); } else { for(Map.Entry<String, String> entry : filesSection.entrySet()) { if(perDbIni.containsKey(PolicyFileConstants.USERS)) { configErrors.add("Per-db policy file cannot contain " + PolicyFileConstants.USERS + " section in " + perDbPolicy); throw new SentryConfigurationException("Per-db policy files cannot contain " + PolicyFileConstants.USERS + " section"); throw new SentryConfigurationException("Per-db policy files cannot contain " + PolicyFileConstants.DATABASES + " section");
throw new SentryConfigurationException("Didn't find a hive-site.xml");