Package org.springframework.security.userdetails

Examples of org.springframework.security.userdetails.User


            // 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

            configAttribEd.setAsText(props.getProperty(username));

            // if the parsing succeeded turn that into a user object
            UserAttribute attr = (UserAttribute) configAttribEd.getValue();
            if (attr != null) {
                User user = createUserObject(username, attr.getPassword(), attr.isEnabled(), attr.getAuthorities());
                users.put(username, user);
            }
        }

        return users;
View Full Code Here

        return users;
    }

    protected User createUserObject(String username,String password, boolean isEnabled,GrantedAuthority[] authorities) {
       return new User(username, password, isEnabled, true, true,
                true, authorities);
    }
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

   */
  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

        }));
    }
   
    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

         * Converts this UI view back into an Spring {@link User} object
         *
         * @return
         */
        public User toSpringUser() {
            return new User(username, password, enabled, true, true, true,
                    toGrantedAuthorities(authorities));
        }
View Full Code Here

TOP

Related Classes of org.springframework.security.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.