/** saves the user group service config to persistence */ public void saveConfig(SecurityNamedServiceConfig config) throws IOException { Resource dir = getRoot().get(config.getName()); boolean isNew = config.getId() == null; if (isNew) { config.setId(newId()); } try { saveConfigFile(config, dir, persister()); } catch (Exception e) { // catch exception, if the config was new, clear out the id since it was not added if (isNew) { config.setId(null); } if (e instanceof IOException) { throw (IOException) e; } throw new IOException(e); } }
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(); } }
/** * Determines if the configuration object represents a new configuration, or an existing one. */ protected boolean isNew() { return configModel.getObject().getId() == null; }
/** * Determines if the configuration object represents a new configuration, or an existing one. */ protected boolean isNew() { return configModel.getObject().getId() == null; }
/** * Determines if the configuration object represents a new configuration, or an existing one. */ protected boolean isNew() { return configModel.getObject().getId() == null; }
public SecurityNamedServicePanel(String id, IModel<T> model) { super(id, new Model()); this.configModel = model; // check for administrator, if not disable the panel and emit warning message boolean isAdmin = getSecurityManager().checkAuthenticationForAdminRole(); setEnabled(isAdmin); add( new Label( "message", isAdmin ? new Model() : new StringResourceModel("notAdmin", this, null))); if (!isAdmin) { get("message").add(new AttributeAppender("class", new Model("info-link"), " ")); } setOutputMarkupId(true); add(new TextField("name").setRequired(true).setEnabled(model.getObject().getId() == null)); add(dialog = new GeoServerDialog("dialog")); }
public SecurityNamedServicePanel(String id, IModel<T> model) { super(id, new Model()); this.configModel = model; //check for administrator, if not disable the panel and emit warning message boolean isAdmin = getSecurityManager().checkAuthenticationForAdminRole(); setEnabled(isAdmin); add(new Label("message", isAdmin ? new Model() : new StringResourceModel("notAdmin", this, null))); if (!isAdmin) { get("message").add(new AttributeAppender("class", new Model("info-link"), " ")); } setOutputMarkupId(true); add(new TextField("name").setRequired(true).setEnabled(model.getObject().getId() == null)); add(dialog = new GeoServerDialog("dialog")); }
public SecurityNamedServicePanel(String id, IModel<T> model) { super(id, new Model()); this.configModel = model; //check for administrator, if not disable the panel and emit warning message boolean isAdmin = getSecurityManager().checkAuthenticationForAdminRole(); setEnabled(isAdmin); add(new Label("message", isAdmin ? new Model() : new StringResourceModel("notAdmin", this, null))); if (!isAdmin) { get("message").add(new AttributeAppender("class", new Model("info-link"), " ")); } setOutputMarkupId(true); add(new TextField("name").setRequired(true).setEnabled(model.getObject().getId() == null)); add(dialog = new GeoServerDialog("dialog")); }