Package org.geoserver.security.impl

Examples of org.geoserver.security.impl.GeoServerUser


       
        tester.assertErrorMessages(new String[0]);
        tester.assertRenderedPage(SecurityNamedServiceEditPage.class);
       
        GeoServerUser user = ugService.getUserByUsername("testuser");
        assertNotNull(user);
        assertTrue(user.isEnabled());
       
        SortedSet<GeoServerUserGroup> groupList = ugService.getGroupsForUser(user);
        assertEquals(1,groupList.size());
        assertEquals("group1",groupList.iterator().next().getGroupname());
       
        SortedSet<GeoServerRole> roleList = gaService.getRolesForUser("testuser");
        assertEquals(0,roleList.size());
       
        user = (GeoServerUser) ugService.loadUserByUsername("testuser");
        assertEquals(3,user.getAuthorities().size());
        assertTrue(user.getAuthorities().contains(gaService.createRoleObject("ROLE_AUTHENTICATED")));
        assertTrue(user.getAuthorities().contains(gaService.createRoleObject("ROLE_WFS")));
        assertTrue(user.getAuthorities().contains(gaService.createRoleObject("ROLE_WMS")));
       
    }
View Full Code Here


        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();
       
View Full Code Here

    }
   
    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();
    }
View Full Code Here

    }
    protected void checkValuesInserted(GeoServerUserGroupService userGroupService) throws IOException {
        assertEquals(5, userGroupService.getUsers().size());
        assertEquals(5, userGroupService.getUserCount());
       
        GeoServerUser admin = (GeoServerUser) userGroupService.getUserByUsername(GeoServerUser.ADMIN_USERNAME);
        GeoServerUser user1 = (GeoServerUser) userGroupService.getUserByUsername("user1");
        GeoServerUser user2 = (GeoServerUser) userGroupService.getUserByUsername("user2");
        GeoServerUser disableduser = (GeoServerUser) userGroupService.getUserByUsername("disableduser");
        GeoServerUser groupAdminUser = (GeoServerUser) userGroupService.getUserByUsername("groupAdminUser");
       
        assertNull(userGroupService.getUserByUsername("xxx"));
   
        assertTrue(userGroupService.getUsers().contains(admin));
        assertTrue(userGroupService.getUsers().contains(user1));
        assertTrue(userGroupService.getUsers().contains(user2));
        assertTrue(userGroupService.getUsers().contains(disableduser));
        assertTrue(userGroupService.getUsers().contains(groupAdminUser));

        // check if properties are loaded too
        for (GeoServerUser user : userGroupService.getUsers() ) {
            if (user2.getUsername().equals(user.getUsername())) {
                assertEquals(2,user.getProperties().size());
                assertEquals(user.getProperties().getProperty("mail"),"user2@gmx.com");
                assertEquals(user.getProperties().getProperty("tel"),"12-34-38");               
            } else {
                assertEquals(0,user.getProperties().size());
            }
        }
       
        assertTrue(admin.isEnabled());
        assertTrue(user1.isEnabled());
        assertTrue(user2.isEnabled());
        assertFalse(disableduser.isEnabled());
        assertTrue(groupAdminUser.isEnabled());

        /*assertFalse(user1.isGroupAdmin());
        assertFalse(user2.isGroupAdmin());
        assertTrue(groupAdminUser.isGroupAdmin());*/

 
View Full Code Here

        assertEquals(user2.getProperties().getProperty("mail"),"user2@gmx.com");
        assertEquals(user2.getProperties().getProperty("tel"),"12-34-38");                                   
       
    }
    protected void checkValuesModified(GeoServerUserGroupService userGroupService) throws IOException {
        GeoServerUser disableduser = userGroupService.getUserByUsername("disableduser");
        assertTrue(disableduser.isEnabled());
        GeoServerMultiplexingPasswordEncoder encoder = getEncoder(userGroupService);
        assertTrue(encoder.isPasswordValid(disableduser.getPassword(), "hallo", null));
        assertEquals(1, disableduser.getProperties().size());
        assertEquals("miller", disableduser.getProperties().getProperty("lastname"));
       
        GeoServerUser user2 = userGroupService.getUserByUsername("user2");
        assertEquals(1, user2.getProperties().size());
        assertEquals("11-22-33", user2.getProperties().getProperty("tel"));
       
        GeoServerUserGroup disabledgroup = userGroupService.getGroupByGroupname("disabledgroup");
        assertTrue(disabledgroup.isEnabled());
   
        GeoServerUserGroup group1 = userGroupService.getGroupByGroupname("group1");
        GeoServerUser user1 = userGroupService.getUserByUsername("user1");
        assertEquals(1,userGroupService.getUsersForGroup(group1).size());
        assertTrue(userGroupService.getUsersForGroup(group1).contains(user1));
   
        assertEquals(0,userGroupService.getGroupsForUser(user2).size());
       
View Full Code Here

            assertSecurityException(ex, GROUP_NOT_FOUND_$1,"group1xxx");
            failed=true;
        }
        assertTrue(failed);

        GeoServerUser user1 = store.getUserByUsername("user1");
        GeoServerUserGroup group1 = store.getGroupByGroupname("group1");
        failed=false;
        try {
            store.associateUserToGroup(
                    store.createUserObject("xxx", "abc", true),
View Full Code Here

        assertEquals("11-22-33", user2.getProperties().getProperty("tel"));
       
    }
    protected void checkValuesRemoved(GeoServerUserGroupService userGroupService) throws IOException {
       
        GeoServerUser admin = GeoServerUser.createDefaultAdmin();
        GeoServerUser user1 = (GeoServerUser) userGroupService.getUserByUsername("user1");
        GeoServerUser disableduser = (GeoServerUser) userGroupService.getUserByUsername("disableduser");
        GeoServerUser groupAdminUser = (GeoServerUser) userGroupService.getUserByUsername("groupAdminUser");
   
        assertEquals(4, userGroupService.getUsers().size());
        assertEquals(4, userGroupService.getUserCount());
        assertTrue(userGroupService.getUsers().contains(admin));
        assertTrue(userGroupService.getUsers().contains(user1));
View Full Code Here

        assertEquals(0,userGroupService.getUsersHavingPropertyValue("tel","11-22-33").size());

    }
    public void insertValues(GeoServerUserGroupStore userGroupStore) throws Exception {
               
        GeoServerUser admin = userGroupStore.createUserObject(GeoServerUser.ADMIN_USERNAME,
                GeoServerUser.DEFAULT_ADMIN_PASSWD, GeoServerUser.AdminEnabled);
        GeoServerUser user1 = userGroupStore.createUserObject("user1", "11111", true);
        GeoServerUser user2 = userGroupStore.createUserObject("user2", "22222", true);
        GeoServerUser disableduser = userGroupStore.createUserObject("disableduser", "", false);
        GeoServerUser groupAdminUser = userGroupStore.createUserObject("groupAdminUser", "foo", true);
        //groupAdminUser.setGroupAdmin(true);
       
        user2.getProperties().put("mail","user2@gmx.com");
        user2.getProperties().put("tel","12-34-38");
       
View Full Code Here

        userGroupStore.associateUserToGroup(disableduser, disabledgroup);
        userGroupStore.associateUserToGroup(groupAdminUser, group2);
   
    }
    public void modifyValues(GeoServerUserGroupStore userGroupStore) throws Exception {
        GeoServerUser disableduser = userGroupStore.getUserByUsername("disableduser");
        disableduser.setEnabled(true);
        disableduser.setPassword("hallo");
        disableduser.getProperties().put("lastname","miller");
        userGroupStore.updateUser(disableduser);

       
        GeoServerUser user2 = userGroupStore.getUserByUsername("user2");
        user2.getProperties().remove("mail");
        user2.getProperties().put("tel", "11-22-33");
        userGroupStore.updateUser(user2);
       
        GeoServerUserGroup disabledgroup = userGroupStore.getGroupByGroupname("disabledgroup");
        disabledgroup.setEnabled(true);
        userGroupStore.updateGroup(disabledgroup);
View Full Code Here

        GeoServerUserGroup group1 = userGroupStore.getGroupByGroupname("group1");
        userGroupStore.disAssociateUserFromGroup(user2, group1);
       
    }
    public void removeValues(GeoServerUserGroupStore userGroupStore) throws IOException {
        GeoServerUser user2 = userGroupStore.getUserByUsername("user2");
        if (user2 != null) {
            userGroupStore.removeUser(user2);
        }
        GeoServerUserGroup disabledGroup = userGroupStore.getGroupByGroupname("disabledgroup");
        if (disabledGroup != null) {
View Full Code Here

TOP

Related Classes of org.geoserver.security.impl.GeoServerUser

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.