Package org.beangle.security

Examples of org.beangle.security.User


      }
    }
  }

  public void registerAuthorities(Long userId) {
    User user = (User) entityDao.get(User.class, userId);
    Set<Group> groups = userService.getGroups(user);
    Long[] groupIds = new Long[groups.size()];
    int i = 0;
    for (final Group group : groups) {
      registerGroupAuthorities(group);
      groupIds[i++] = group.getId();
    }
    userGroupIds.put(user.getId(), groupIds);
  }
View Full Code Here


      }
    }
  }

  public void registerAuthorities(Long userId) {
    User user = (User) entityDao.get(User.class, userId);
    Set groups = userService.getGroups(user);
    Long[] groupIds = new Long[groups.size()];
    int i = 0;
    for (Iterator iter = groups.iterator(); iter.hasNext();) {
      Group group = (Group) iter.next();
      registerGroupAuthorities(group);
      groupIds[i++] = group.getId();
    }
    userGroupIds.put(user.getId(), groupIds);
  }
View Full Code Here

  private final Logger logger = LoggerFactory.getLogger(DaoAuthenticationProvider.class);
  private PasswordEncoder passwordEncoder;

  public Authentication authenticate(Authentication auth) throws AuthenticationException {
    logger.debug("Authentication using {}", getClass());
    User user = attachToUser(auth);
    if (!passwordEncoder.isPasswordValid(user.getPassword(), (String) auth.getCredentials())) {
      throw new BadCredentialsException(Authentication.ERROR_PASSWORD);
    }
    return auth;
  }
View Full Code Here

  public void setUserService(UserService userService) {
    this.userService = userService;
  }

  public User attachToUser(Authentication auth) {
    User user = userService.get((String) auth.getPrincipal());
    if (null == user) {
      throw new AuthenticationException(Authentication.ERROR_NOTEXIST);
    }
    if (!user.isEnabled()) {
      throw new AuthenticationException(Authentication.ERROR_UNACTIVE);
    }
    if (null == auth.getDetails()) {
      auth.setDetails(new UserDetails());
    }
    UserDetails details = (UserDetails) auth.getDetails();
    details.setUserid(user.getId());
    details.setFullname(user.getFullname());
    details.setCategory(entityDao.get(UserCategory.class, user.getDefaultCategory().getId()));
    return user;
  }
View Full Code Here

  public void setUserService(UserService userService) {
    this.userService = userService;
  }

  public User attachToUser(Authentication auth) {
    User user = userService.get((String) auth.getPrincipal());
    if (null == user) {
      throw new AuthenticationException(Authentication.ERROR_NOTEXIST);
    }
    if (!user.isEnabled()) {
      throw new AuthenticationException(Authentication.ERROR_UNACTIVE);
    }
    if (null == auth.getDetails()) {
      auth.setDetails(new UserDetails());
    }
    UserDetails details = (UserDetails) auth.getDetails();
    details.setUserid(user.getId());
    details.setFullname(user.getFullname());
    details.setCategory(user.getDefaultCategory());
    return user;
  }
View Full Code Here

TOP

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