/** Additional validation, check if the file exists or can be created */ @Override public void validateAddRoleService(SecurityRoleServiceConfig config) throws SecurityConfigException { super.validateAddRoleService(config); XMLRoleServiceConfig xmlConfig = (XMLRoleServiceConfig) config; File file = new File(xmlConfig.getFileName()); if (checkFile(file) == false) throw createSecurityException(FILE_CREATE_FAILED_$1, file.getPath()); }
/** Saves/persists a role service configuration. */ public void saveRoleService(SecurityRoleServiceConfig config) throws IOException, SecurityConfigException { SecurityConfigValidator validator = SecurityConfigValidator.getConfigurationValiator( GeoServerRoleService.class, config.getClassName()); if (config.getId() == null) { config.initBeforeSave(); validator.validateAddRoleService(config); } else { validator.validateModifiedRoleService( config, roleServiceHelper.loadConfig(config.getName())); } roleServiceHelper.saveConfig(config); // remove from cache roleServices.remove(config.getName()); // update active role service if (activeRoleService != null && config.getName().equals(activeRoleService.getName())) { synchronized (activeRoleService) { activeRoleService.initializeFromConfig(config); } } }
config.setAdminRoleName(role.getAuthority()); try { validator.validateAddRoleService(config); fail("reserved role name should fail"); config.setGroupAdminRoleName(role.getAuthority()); try { validator.validateAddRoleService(config); fail("resoerved role name should fail");
validator.validateAddRoleService( createRoleConfig( XMLRoleService.DEFAULT_NAME,