public GeoServerUserGroupStore createStore() throws IOException { return service.createStore(); }
@Override public GeoServerUserGroupStore createStore() throws IOException { try { return getClass() .getConstructor(GeoServerUserGroupService.class) .newInstance(delegate.createStore()); } catch (Exception e) { throw new IOException(e); } }
public GeoServerUserGroupStore createStore(GeoServerUserGroupService service) throws IOException { return service.createStore(); }
@Override public GeoServerUserGroupStore createStore() throws IOException { return new GroupAdminUserGroupService(delegate.createStore(), groups); }
@Override public GeoServerUserGroupStore createStore() throws IOException { GeoServerUserGroupStore store = getService().createStore(); return store != null ? new LockingUserGroupStore(store) : null; }
protected void updateUser(String ugService, String userName, boolean enabled) throws Exception { GeoServerUserGroupService ugservice = getSecurityManager().loadUserGroupService(ugService); GeoServerUserGroupStore ugstore = ugservice.createStore(); GeoServerUser u1 = ugstore.getUserByUsername(userName); u1.setEnabled(enabled); ugstore.updateUser(u1); ugstore.store(); }
GeoServerUserGroupStore userGroupStore = userGroupService.createStore(); GeoServerRoleStore roleStore = roleService.createStore();
GeoServerUserGroupService ugService = secMgr.loadUserGroupService("default"); GeoServerUserGroupStore ugStore = ugService.createStore(); GeoServerUser user = ugStore.createUserObject(username, password, true); ugStore.addUser(user);
protected void createServices() throws Exception { GeoServerRoleService rservice = createRoleService("rs1"); GeoServerRoleStore rstore = rservice.createStore(); GeoServerRole root, derived; rstore.addRole(root = rstore.createRoleObject(rootRole)); rstore.addRole(derived = rstore.createRoleObject(derivedRole)); rstore.setParentRole(derived, root); rstore.associateRoleToUser(derived, testUserName); rstore.associateRoleToUser(derived, "castest"); rstore.store(); SecurityManagerConfig mconfig = getSecurityManager().loadSecurityConfig(); mconfig.setRoleServiceName("rs1"); getSecurityManager().saveSecurityConfig(mconfig); GeoServerUserGroupService ugservice = createUserGroupService("ug1"); GeoServerUserGroupStore ugstore = ugservice.createStore(); GeoServerUser u1 = ugstore.createUserObject(testUserName, testPassword, true); ugstore.addUser(u1); GeoServerUser u2 = ugstore.createUserObject("abc@xyz.com", "abc", true); ugstore.addUser(u2); GeoServerUser u3 = ugstore.createUserObject("castest", "castest", true); ugstore.addUser(u3); ugstore.store(); GeoServerAuthenticationProvider prov = createAuthProvider(testProviderName, ugservice.getName()); prepareAuthProviders(prov.getName()); }
public GeoServerUserGroupStore getUserGroupStore(String name) throws IOException{ return getUserGroupService(name).createStore(); }
protected GeoServerUserGroupStore getStore(String serviceName) throws IOException { GeoServerUserGroupService service = securityManager.loadUserGroupService(serviceName); if (service == null) { throw new IllegalArgumentException( "Provided user/group service does not exist: " + serviceName); } else if (service.canCreateStore()) { return securityManager.loadUserGroupService(serviceName).createStore(); } else { throw new IOException("Provided UserGroupService is read-only."); } }
@Override public void doSave(T config) throws Exception { getSecurityManager().saveUserGroupService(config); if (recodeCheckBox.getModelObject()) { GeoServerUserGroupService s = getSecurityManager().loadUserGroupService(config.getName()); if (s.canCreateStore()) { Util.recodePasswords(s.createStore()); } } }
@Override public void doSave(T config) throws Exception { getSecurityManager().saveUserGroupService(config); if (recodeCheckBox.getModelObject()) { GeoServerUserGroupService s = getSecurityManager().loadUserGroupService(config.getName()); if (s.canCreateStore()) { Util.recodePasswords(s.createStore()); } } }
@Override public void doSave(T config) throws Exception { getSecurityManager().saveUserGroupService(config); if (recodeCheckBox.getModelObject()) { GeoServerUserGroupService s = getSecurityManager().loadUserGroupService(config.getName()); if (s.canCreateStore()) { Util.recodePasswords(s.createStore()); } } }
@Before public void removeBill() throws Exception { GeoServerUserGroupStore ugStore = getSecurityManager().loadUserGroupService("gaugs").createStore(); GeoServerUser bill = ugStore.getUserByUsername("bill"); if (bill != null) { ugStore.removeUser(bill); ugStore.store(); } else { ugStore.load(); } }
public void resetUserPassword() throws IOException, PasswordPolicyException { GeoServerUserGroupService service = getSecurityManager().loadUserGroupService(XMLUserGroupService.DEFAULT_NAME); GeoServerUser user = service.getUserByUsername(USERNAME); user.setPassword(USERPW); GeoServerUserGroupStore store = service.createStore(); store.updateUser(user); store.store(); service.load(); }
@Before public void init() throws Exception { GeoServerSecurityManager secMgr = getSecurityManager(); ugStore = secMgr.loadUserGroupService("gaugs").createStore(); roleStore = secMgr.loadRoleService("gars").createStore(); bob = ugStore.getUserByUsername("bob"); alice = ugStore.getUserByUsername("alice"); users = ugStore.getGroupByGroupname("users"); admins = ugStore.getGroupByGroupname("admins"); }
@Test public void testCreateNewUser() throws Exception { setAuth(); GeoServerUserGroupService ugService = getSecurityManager().loadUserGroupService(ugStore.getName()); GeoServerUserGroupStore ugStore = ugService.createStore(); GeoServerUser bill = ugStore.createUserObject("bill", "foobar", true); ugStore.addUser(bill); ugStore.store(); assertNotNull(ugService.getUserByUsername("bill")); }
@Test public void testRemoveUserInGroup() throws Exception { testAssignUserToGroup(); GeoServerUserGroupService ugService = getSecurityManager().loadUserGroupService(ugStore.getName()); GeoServerUserGroupStore ugStore = ugService.createStore(); GeoServerUser bill = ugStore.getUserByUsername("bill"); ugStore.removeUser(bill); ugStore.store(); assertNull(ugStore.getUserByUsername("bill")); }
protected UserGroupStoreValidationWrapper createStore(String name) throws IOException { MemoryUserGroupServiceConfigImpl config = new MemoryUserGroupServiceConfigImpl(); config.setName(name); config.setPasswordEncoderName(getPBEPasswordEncoder().getName()); config.setPasswordPolicyName(PasswordValidator.DEFAULT_NAME); GeoServerUserGroupService service = new MemoryUserGroupService(); service.setSecurityManager(getSecurityManager()); service.initializeFromConfig(config); return new UserGroupStoreValidationWrapper(service.createStore()); }