Package org.acegisecurity.userdetails

Examples of org.acegisecurity.userdetails.User


   
    public UserDetails loadUserByUsername(String string) throws UsernameNotFoundException, DataAccessException {
        GrantedAuthority[] authorities =  new GrantedAuthority[] {
            new GrantedAuthorityImpl("editor"),
            new GrantedAuthorityImpl("admin")};     
        return new User("test", "test", true, true, true, true, authorities);
    }
View Full Code Here


*/
public class AcegiWorkflowContextHandlerInterceptorTests extends AbstractWorkflowContextHandlerInterceptorTests {


  protected MockHttpServletRequest getMockRequest(String userName) {
    User user = new User(userName, "dummy", true, true, true, true, new GrantedAuthority[]{});
    Authentication auth = new UsernamePasswordAuthenticationToken(user, null);
    SecurityContext context = new SecurityContextImpl();
    context.setAuthentication(auth);
    SecurityContextHolder.setContext(context);

View Full Code Here

    // if (!usernameBasedPrimaryKey) {
    // returnUsername = username;
    // }

    return new User(returnUsername, user.getPassword(), user.isEnabled(),
        true, true, true, arrayAuths);
  }
View Full Code Here

    GrantedAuthority arrayAuths[] = (GrantedAuthority[]) (GrantedAuthority[]) dbAuths
        .toArray(new GrantedAuthority[dbAuths.size()]);
    String returnUsername = user.getUsername();
    if (!isUsernameBasedPrimaryKey())
      returnUsername = username;
    return new User(returnUsername, user.getPassword(), user.isEnabled(),
        true, true, true, arrayAuths);
  }
View Full Code Here

    protected Object mapRow(ResultSet rs, int rownum) throws SQLException {
      String username = rs.getString(1);
      String password = rs.getString(2);
      boolean enabled = rs.getBoolean(3);
      UserDetails user = new User(username,password,enabled,true,true,true,
          new GrantedAuthority[] { new GrantedAuthorityImpl("HOLDER") });
      return user;
    }
View Full Code Here

    protected synchronized UserDetails authenticate(String username, String password) throws AuthenticationException {
        try {
            UnixUser uu = new PAM(serviceName).authenticate(username, password);

            // I never understood why Acegi insists on keeping the password...
            return new User(username,"",true,true,true,true, toAuthorities(uu));
        } catch (PAMException e) {
            throw new BadCredentialsException(e.getMessage(),e);
        }
    }
View Full Code Here

        if(!UnixUser.exists(username))
            throw new UsernameNotFoundException("No such Unix user: "+username);
        try {
            UnixUser uu = new UnixUser(username);
            // return some dummy instance
            return new User(username,"",true,true,true,true, toAuthorities(uu));
        } catch (PAMException e) {
            throw new UsernameNotFoundException("Failed to load information about Unix user "+username,e);
        }
    }
View Full Code Here

    public void setUserDetailsService(UserDetailsService userDetailsService) {
        this.userDetailsService = userDetailsService;
    }

    public UserDetails getUserDetails(String userName) throws AuthenticationException {
        User userObject = (User) userDetailsService.loadUserByUsername(userName);

        // in  a more sophisticated implementation we would look up and insert
        // GrantedAuthoritys here.

        return userObject;
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

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.