public void validateRemoveFilter(SecurityNamedServiceConfig config) throws SecurityConfigException { validateRemoveNamedService(GeoServerSecurityFilter.class, config); List<String> patterns = manager.getSecurityConfig() .getFilterChain() .patternsForFilter(config.getClassName(), false); if (patterns.isEmpty() == false) { throw createSecurityException( SecurityConfigException.FILTER_STILL_USED, config.getName(), StringUtils.arrayToCommaDelimitedString(patterns.toArray())); } }
public void validateModifiedNamedService( Class<?> extensionPoint, SecurityNamedServiceConfig config) throws SecurityConfigException { checkExtensionPont(extensionPoint, config.getClassName()); checkServiceName(extensionPoint, config.getName()); SortedSet<String> names = getNamesFor(extensionPoint); if (names.contains(config.getName()) == false) throw createSecurityException(notFoundErrorCode(extensionPoint), config.getName()); }
/** Loads the auth provider for the named config from persistence. */ public GeoServerAuthenticationProvider load(String name) throws IOException { SecurityNamedServiceConfig config = loadConfig(name); if (config == null) { // no such config return null; } // look up the service for this config GeoServerAuthenticationProvider authProvider = null; for (GeoServerSecurityProvider p : lookupSecurityProviders()) { if (p.getAuthenticationProviderClass() == null) { continue; } if (p.getAuthenticationProviderClass().getName().equals(config.getClassName())) { authProvider = p.createAuthenticationProvider(config); break; } } if (authProvider == null) { throw new IOException("No authentication provider matching config: " + config); } authProvider.setName(name); authProvider.setSecurityManager(GeoServerSecurityManager.this); authProvider.initializeFromConfig(config); return authProvider; }
/** Loads the filter for the named config from persistence. */ public GeoServerSecurityFilter load(String name) throws IOException { SecurityNamedServiceConfig config = loadConfig(name); if (config == null) { // no such config return null; } // look up the service for this config GeoServerSecurityFilter filter = null; for (GeoServerSecurityProvider p : lookupSecurityProviders()) { if (p.getFilterClass() == null) { continue; } if (p.getFilterClass().getName().equals(config.getClassName())) { filter = p.createFilter(config); break; } } if (filter == null) { throw new IOException("No authentication provider matching config: " + config); } filter.setName(name); filter.setSecurityManager(GeoServerSecurityManager.this); filter.initializeFromConfig(config); return filter; }
public void validateAddNamedService(Class<?> extensionPoint, SecurityNamedServiceConfig config) throws SecurityConfigException { checkExtensionPont(extensionPoint, config.getClassName()); checkServiceName(extensionPoint, config.getName()); SortedSet<String> names = getNamesFor(extensionPoint); if (names.contains(config.getName())) throw createSecurityException(alreadyExistsErrorCode(extensionPoint), config.getName()); }
public void removeFilter(SecurityNamedServiceConfig config) throws IOException, SecurityConfigException { SecurityConfigValidator validator = SecurityConfigValidator.getConfigurationValiator( GeoServerSecurityFilter.class, config.getClassName()); validator.validateRemoveFilter(config); getAuthenticationCache().removeAll(config.getName()); filterHelper.removeConfig(config.getName()); }
continue; if (p.getUserGroupServiceClass().getName().equals(config.getClassName())) { service = p.createUserGroupService(config); break; boolean needsLockProtection = GeoServerSecurityProvider.getProvider( GeoServerUserGroupService.class, config.getClassName()) .roleServiceNeedsLockProtection(); if (needsLockProtection) service = new LockingUserGroupService(service);
continue; if (p.getRoleServiceClass().getName().equals(config.getClassName())) { service = p.createRoleService(config); break; boolean needsLockProtection = GeoServerSecurityProvider.getProvider( GeoServerRoleService.class, config.getClassName()) .roleServiceNeedsLockProtection(); if (needsLockProtection) {
public void saveFilter(SecurityNamedServiceConfig config, MigrationHelper migrationHelper) throws IOException, SecurityConfigException { SecurityConfigValidator validator = SecurityConfigValidator.getConfigurationValiator( GeoServerSecurityFilter.class, config.getClassName()); boolean fireChanged = false; if (config.getId() == null) { config.initBeforeSave(); validator.validateAddFilter(config); } else { validator.validateModifiedFilter( config, filterHelper.loadConfig(config.getName(), migrationHelper)); // remove all cached authentications for this filter getAuthenticationCache().removeAll(config.getName()); if (!securityConfig .getFilterChain() .patternsForFilter(config.getName(), true) .isEmpty()) { fireChanged = true; } } filterHelper.saveConfig(config); if (fireChanged) { fireChanged(); } }
@Override public Object getPropertyValue(SecurityNamedServiceConfig item) { //do a resource lookup return new ResourceModel(item.getClassName() + ".title", item.getClassName()).getObject(); } };
@Override public Object getPropertyValue(SecurityNamedServiceConfig item) { // do a resource lookup return new ResourceModel(item.getClassName() + ".title", item.getClassName()) .getObject(); } };
@Override public Object getPropertyValue(SecurityNamedServiceConfig item) { //do a resource lookup return new ResourceModel(item.getClassName() + ".title", item.getClassName()).getObject(); } };
SecurityNamedServicePanelInfo lookupPageInfo(SecurityNamedServiceConfig config) { Class serviceClass = null; try { serviceClass = Class.forName(config.getClassName()); } catch (ClassNotFoundException e) { throw new RuntimeException(e);
SecurityNamedServicePanelInfo lookupPageInfo(SecurityNamedServiceConfig config) { Class serviceClass = null; try { serviceClass = Class.forName(config.getClassName()); } catch (ClassNotFoundException e) { throw new RuntimeException(e);
Class serviceClass = null; try { serviceClass = Class.forName(config.getClassName()); } catch (ClassNotFoundException e) { throw new RuntimeException(e);
Class serviceClass = null; try { serviceClass = Class.forName(config.getClassName()); } catch (ClassNotFoundException e) { throw new RuntimeException(e);
SecurityNamedServicePanelInfo lookupPageInfo(SecurityNamedServiceConfig config) { Class serviceClass = null; try { serviceClass = Class.forName(config.getClassName()); } catch (ClassNotFoundException e) { throw new RuntimeException(e);
Class serviceClass = null; try { serviceClass = Class.forName(config.getClassName()); } catch (ClassNotFoundException e) { throw new RuntimeException(e);