protected void setServices(String serviceName) throws Exception { roleService = createRoleService(serviceName); usergroupService = createUserGroupService(serviceName); roleStore = createStore(roleService); usergroupStore = createStore(usergroupService); getSecurityManager().setActiveRoleService(roleService); // getSecurityManager().saveSecurityConfig(config)setActiveUserGroupService(usergroupService); }
@Override protected TestData buildTestData() throws Exception { if ("h2".equalsIgnoreCase(getFixtureId())) return super.buildTestData(); return new LiveDbmsDataSecurity(getFixtureId()); }
@Override protected SystemTestData createTestData() throws Exception { if ("h2".equalsIgnoreCase(getFixtureId())) return super.createTestData(); return new LiveDbmsDataSecurity(getFixtureId()); }
@Override public GeoServerRoleStore createStore(GeoServerRoleService service) throws IOException { JDBCRoleStore store = (JDBCRoleStore) super.createStore(service); try { JDBCTestSupport.dropExistingTables(store, store.getConnection()); } catch (SQLException e) { throw new IOException(e); } store.createTables(); store.store(); return store; }
@Test public void testRoleCalculation() throws Exception { setServices("rolecalulation"); insertValues(roleStore); insertValues(usergroupStore); checkRoles(username, roles); roleStore.associateRoleToUser(role, username); roles.add(role); checkRoles(username, roles); roleStore.associateRoleToUser(role, username); roles.add(role); checkRoles(username, roles); roleStore.associateRoleToGroup(role, "theGroup1"); roles.add(role); checkRoles(username, roles); roleStore.associateRoleToGroup(role, "theGroup1"); roles.add(role); checkRoles(username, roles); roleStore.addRole(role); roleStore.associateRoleToGroup(role, "theGroup2"); checkRoles(username, roles); usergroupStore.updateGroup(theGroup2);
@Test public void testPersonalizedRoles() throws Exception { setServices("personalizedRoles"); insertValues(roleStore); insertValues(usergroupStore); roleStore.associateRoleToUser(role, username); syncbackends();
@Test public void testConfiguration() throws Exception { setServices("config"); assertEquals(roleService, getSecurityManager().getActiveRoleService()); // assertEquals(usergroupService,getSecurityManager().getActiveUserGroupService()); assertEquals( usergroupService.getName(), getSecurityManager().loadUserGroupService("config").getName()); assertTrue(roleService.canCreateStore()); assertTrue(usergroupService.canCreateStore()); }
@Override protected void setServices(String serviceName) throws Exception { if (getSecurityManager().loadRoleService(getFixtureId()) == null) super.setServices(getFixtureId()); else { roleService = getSecurityManager().loadRoleService(getFixtureId()); roleStore = createStore(roleService); usergroupService = getSecurityManager().loadUserGroupService(getFixtureId()); usergroupStore = createStore(usergroupService); getSecurityManager().setActiveRoleService(roleService); } }
@Override public GeoServerUserGroupStore createStore(GeoServerUserGroupService service) throws IOException { JDBCUserGroupStore store = (JDBCUserGroupStore) super.createStore(service); try { JDBCTestSupport.dropExistingTables(store,store.getConnection()); } catch (SQLException e) { throw new IOException(e); } store.createTables(); store.store(); return store; }
@Override public GeoServerUserGroupStore createStore(GeoServerUserGroupService service) throws IOException { JDBCUserGroupStore store = (JDBCUserGroupStore) super.createStore(service); try { JDBCTestSupport.dropExistingTables(store, store.getConnection()); } catch (SQLException e) { throw new IOException(e); } store.createTables(); store.store(); return store; }
@Override public GeoServerRoleStore createStore(GeoServerRoleService service) throws IOException { JDBCRoleStore store = (JDBCRoleStore) super.createStore(service); try { JDBCTestSupport.dropExistingTables(store,store.getConnection()); } catch (SQLException e) { throw new IOException(e); } store.createTables(); store.store(); return store; }