Package org.acegisecurity.userdetails

Examples of org.acegisecurity.userdetails.User


   */
  private void createDefaultUser() {
    String name = (geoServer == null ? "admin" : geoServer.getGlobal().getAdminUsername());
    String passwd = (geoServer == null ? "geoserver" : geoServer.getGlobal().getAdminPassword());

    myDetailStorage.put(name, new User(name,
    passwd,
    true,
    true,
    true,
    true,
View Full Code Here


   * @param username the name of the new user
   * @param attrs the attributes to assign to the new user (authorities and credentials)
   * @return a UserDetails object with the provided username and attributes
   */
  private UserDetails makeUser(String username, UserAttribute attrs) {
    return new User(
  username,
  attrs.getPassword(),
  attrs.isEnabled(),
  true, // account not expired
  true, // credentials not expired
View Full Code Here

public class XACMLGeoserverUserDao extends GeoserverUserDao {

    @Override
    protected User createUserObject(String username, String password, boolean isEnabled,
            GrantedAuthority[] authorities) {
        User user = super.createUserObject(username, password, isEnabled, authorities);
        GeoXACMLConfig.getXACMLRoleAuthority().transformUserDetails(user);
        return user;
    }
View Full Code Here

             ga[i] = new GrantedAuthorityImpl((String)iter.next());
           }

    UsernamePasswordAuthenticationToken upat =
      new UsernamePasswordAuthenticationToken(
          new User(auth.getName(),
            (auth.getCredentials() == null ? null : auth.getCredentials().toString()),
            true,
            true,
            true,
            true,
View Full Code Here

            // ok
        }
    }
   
    public void testSetUser() throws Exception {
        dao.setUser(new User("wfs", "pwd", true, true, true, true,
                new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_WFS_ALL"), new GrantedAuthorityImpl("ROLE_WMS_ALL")}));
        UserDetails user = dao.loadUserByUsername("wfs");
        assertEquals("wfs", user.getUsername());
        assertEquals("pwd", user.getPassword());
        assertEquals(2, user.getAuthorities().length);
View Full Code Here

        assertEquals("ROLE_WMS_ALL", user.getAuthorities()[1].getAuthority());
    }
   
    public void testSetMissingUser() throws Exception {
        try {
            dao.setUser(new User("notther", "pwd", true, true, true, true,
                    new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_WFS_ALL")}));
            fail("The user is not there, setUser should fail");
        } catch(IllegalArgumentException e) {
            // cool
        }
View Full Code Here

            // cool
        }
    }
   
    public void testAddUser() throws Exception {
        dao.putUser(new User("newuser", "pwd", true, true, true, true,
                new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_WFS_ALL")}));
        assertNotNull(dao.loadUserByUsername("newuser"));
    }
View Full Code Here

        assertNotNull(dao.loadUserByUsername("newuser"));
    }
   
    public void addExistingUser() throws Exception {
        try {
            dao.putUser(new User("admin", "pwd", true, true, true, true,
                    new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_WFS_ALL")}));
            fail("The user is already there, addUser should fail");
        } catch(IllegalArgumentException e) {
            // cool
        }
View Full Code Here

        }));
    }
   
    public void testRemoveDataAccessRule() {
        GrantedAuthority[] authorities = new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_FRANK") };
        setupPanel(new User("frank", "francesco", true, true, true, true, authorities));
       
        // print(tester.getLastRenderedPage(), true, true);
       
        tester.assertRenderedPage(FormTestPage.class);
        tester.assertNoErrorMessage();
View Full Code Here

    private GeoserverUserDao dao;

    @Override
    protected void setUpInternal() throws Exception {
        dao = GeoserverUserDao.get();
        dao.putUser(new User("user", "pwd", true, true, true, true,
                new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_WFS_ALL"), new GrantedAuthorityImpl("ROLE_WMS_ALL")}));
        login();
        tester.startPage(UserPage.class);
    }
View Full Code Here

TOP

Related Classes of org.acegisecurity.userdetails.User

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.