Package org.geoserver.security

Examples of org.geoserver.security.GeoServerSecurityManager$RoleServiceHelper


                assertEquals(FILE_CREATE_FAILED_$1, ex.getId());
                assertEquals(invalidPath, ex.getArgs()[0]);
            }
        }

        GeoServerSecurityManager secMgr = createNiceMock(GeoServerSecurityManager.class);

        GeoServerRoleService roleService1 = createNiceMock(GeoServerRoleService.class);
        expect(roleService1.getRoleCount()).andReturn(0).anyTimes();
        expect(secMgr.loadRoleService("test1")).andReturn(roleService1).anyTimes();

        GeoServerRoleService roleService2 = createNiceMock(GeoServerRoleService.class);
        expect(roleService2.getRoleCount()).andReturn(1).anyTimes();
        expect(secMgr.loadRoleService("test2")).andReturn(roleService2).anyTimes();

        GeoServerRoleService roleService3 = createNiceMock(GeoServerRoleService.class);
        expect(roleService3.getRoleCount()).andReturn(1).anyTimes();
        expect(secMgr.loadRoleService("test3")).andReturn(roleService3).anyTimes();

        GeoServerRoleService roleService4 = createNiceMock(GeoServerRoleService.class);
        expect(roleService4.getRoleCount()).andReturn(1).anyTimes();
        expect(secMgr.loadRoleService("test4")).andReturn(roleService4).anyTimes();

        GeoServerRoleService activeRoleService = createNiceMock(GeoServerRoleService.class);
        expect(activeRoleService.getName()).andReturn("foo").anyTimes();
        expect(secMgr.getActiveRoleService()).andReturn(activeRoleService).anyTimes();
       
        expect(secMgr.listRoleServices()).andReturn(new TreeSet<String>(
            Arrays.asList("test1", "test2", "test3", "test4"))).anyTimes();
       
        replay(roleService1, roleService2, roleService3, roleService4, activeRoleService, secMgr);

        validator = new XMLSecurityConfigValidator(secMgr);
View Full Code Here


  private static final long serialVersionUID = 1L;

  @Override
    protected Collection<GeoServerRole> load() {
        GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager();
        try {
            return new ArrayList(secMgr.getRolesForAccessControl());
        }
        catch(IOException e) {
            throw new WicketRuntimeException(e);
        }
    }
View Full Code Here

                assertEquals(FILE_CREATE_FAILED_$1, ex.getId());
                assertEquals(invalidPath, ex.getArgs()[0]);
            }
        }
       
        GeoServerSecurityManager secMgr = createNiceMock(GeoServerSecurityManager.class);
        expect(secMgr.listAuthenticationProviders()).andReturn(new TreeSet<String>()).anyTimes();
       
        GeoServerUserGroupService ugService1 = createNiceMock(GeoServerUserGroupService.class);
        expect(ugService1.getName()).andReturn("test1").anyTimes();
        expect(secMgr.loadUserGroupService("test1")).andReturn(ugService1).anyTimes();

        GeoServerUserGroupService ugService2 = createNiceMock(GeoServerUserGroupService.class);
        expect(ugService2.getName()).andReturn("test2").anyTimes();
        expect(ugService2.getGroupCount()).andReturn(1).anyTimes();
        expect(secMgr.loadUserGroupService("test2")).andReturn(ugService2).anyTimes();

        GeoServerUserGroupService ugServiceModify = createNiceMock(GeoServerUserGroupService.class);
        expect(ugServiceModify.getName()).andReturn("testModify").anyTimes();
        expect(secMgr.loadUserGroupService("testModify")).andReturn(ugService2).anyTimes();
       
        expect(secMgr.listUserGroupServices()).andReturn(new TreeSet<String>(
                Arrays.asList("test1", "test2", "testModify"))).anyTimes();

        expect(secMgr.loadPasswordEncoder(getPlainTextPasswordEncoder().getName()))
            .andReturn(getPlainTextPasswordEncoder()).anyTimes();
        expect(secMgr.listPasswordValidators()).andReturn(
            new TreeSet<String>(Arrays.asList(PasswordValidator.DEFAULT_NAME))).anyTimes();
        replay(ugService1, ugService2, ugServiceModify, secMgr);

        //expect(secMgr.listUserGroupServices()).andReturn()
        validator = new XMLSecurityConfigValidator(secMgr);
View Full Code Here

public class RoleServiceConfigListModel
    extends LoadableDetachableModel<List<SecurityRoleServiceConfig>> {

    @Override
    protected List<SecurityRoleServiceConfig> load() {
        GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager();
        List<SecurityRoleServiceConfig> configs = new ArrayList();
        try {
            for (String roleServiceName : secMgr.listRoleServices()) {
                SecurityRoleServiceConfig config = secMgr.loadRoleServiceConfig(roleServiceName);
                configs.add(config);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

public class RolesModel extends LoadableDetachableModel<Collection<GeoServerRole>> {

    @Override
    protected Collection<GeoServerRole> load() {
        GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager();
        try {
            return new ArrayList(secMgr.getActiveRoleService().getRoles());
        }
        catch(IOException e) {
            throw new WicketRuntimeException(e);
        }
    }
View Full Code Here

        assertTrue(wfs.getAuthorities().contains(role_wfs_write));

        assertEquals(1,disabledUser.getAuthorities().size());
        assertTrue(disabledUser.getAuthorities().contains(role_test));
       
        GeoServerSecurityManager securityManager = getSecurityManager();
        File userfile = new File(securityManager.getSecurityRoot(),"users.properties");
        assertFalse(userfile.exists());
        File userfileOld = new File(securityManager.getSecurityRoot(),"users.properties.old");
        assertTrue(userfileOld.exists());

        File roleXSD = new File(new File(securityManager.getRoleRoot(), roleService.getName()),
            XMLConstants.FILE_RR_SCHEMA);
        assertTrue(roleXSD.exists());

        File userXSD = new File (new File(securityManager.getUserGroupRoot(), userService.getName()),
            XMLConstants.FILE_UR_SCHEMA);
        assertTrue(userXSD.exists());
       
        /* does not work from the command line
         *
 
View Full Code Here

public class UserGroupServiceConfigListModel
    extends LoadableDetachableModel<List<SecurityUserGroupServiceConfig>> {

    @Override
    protected List<SecurityUserGroupServiceConfig> load() {
        GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager();
        List<SecurityUserGroupServiceConfig> configs = new ArrayList();
        try {
            for (String ugServiceName : secMgr.listUserGroupServices()) {
                SecurityUserGroupServiceConfig config =
                        secMgr.loadUserGroupServiceConfig(ugServiceName);
                configs.add(config);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

*/
public class DiskQuotaWarningProvider implements GeoServerHomePageContentProvider {

    @Override
    public Component getPageBodyComponent(String id) {
        GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager();
        if (secMgr.checkAuthenticationForAdminRole() && DiskQuotaWarningPanel.getException() != null) {
            return new DiskQuotaWarningPanel(id);
        } else {
            return null;
        }
    }
View Full Code Here

    static class SelectedGroupsModel implements IModel<List<GeoServerUserGroup>> {
        List<GeoServerUserGroup> groups;

        public SelectedGroupsModel(String ugServiceName, GeoServerUser user) {
            try {
                GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager();
                setObject(new ArrayList(secMgr.loadUserGroupService(ugServiceName).getGroupsForUser(user)));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
View Full Code Here

        this.userGroupServiceName = userGroupServiceName;
    }

    @Override
    protected List<GeoServerUserGroup> load() {
        GeoServerSecurityManager secMgr = GeoServerApplication.get().getSecurityManager();
        try {
            return new ArrayList(secMgr.loadUserGroupService(userGroupServiceName).getUserGroups());
        }
        catch(IOException e) {
            throw new WicketRuntimeException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.geoserver.security.GeoServerSecurityManager$RoleServiceHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.