@Deprecated @Override public Object getSalt(Customer customer, String unencodedPassword) { Object salt = null; if (saltSource != null && customer != null) { salt = saltSource.getSalt(new CustomerUserDetails(customer.getId(), customer.getUsername(), unencodedPassword, new ArrayList<GrantedAuthority>())); } return salt; }
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { Customer customer = customerService.readCustomerByUsername(username, false); if (customer == null) { throw new UsernameNotFoundException("The customer was not found"); } boolean isActive = !customer.isDeactivated(); if (Status.class.isAssignableFrom(customer.getClass())) { isActive = isActive && ((Status) customer).isActive(); } List<GrantedAuthority> grantedAuthorities = createGrantedAuthorities(roleService.findCustomerRolesByCustomerId(customer.getId())); return new CustomerUserDetails(customer.getId(), username, customer.getPassword(), isActive, true, !customer.isPasswordChangeRequired(), true, grantedAuthorities); }
public UserDetails createCustomerUserDetails(Customer customer) { List<GrantedAuthority> grantedAuthorities = createGrantedAuthorities(roleService.findCustomerRolesByCustomerId(customer.getId())); CustomerUserDetails userDetails = new CustomerUserDetails(customer.getId(), customer.getUsername(), customer.getPassword(), !customer.isDeactivated(), true, !customer.isPasswordChangeRequired(), true, grantedAuthorities); userDetails.eraseCredentials(); return userDetails; }