protected boolean matchPassword(String password, UserEntity user) { String saltedPassword = saltPassword(password, user.getSalt()); return Context.getProcessEngineConfiguration() .getPasswordManager() .check(saltedPassword, user.getPassword()); }
protected boolean matchPassword(String password, UserEntity user) { String saltedPassword = saltPassword(password, user.getSalt()); return Context.getProcessEngineConfiguration() .getPasswordManager() .check(saltedPassword, user.getPassword()); }
public class CustomUser extends org.springframework.security.userdetails.User {.....} @Entity public class UserEntity {...} public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { UserEntity userEntity = this.customUserRepository.findByUsername(username); CustomUser customUser = new CustomUser( userEntity.getUsername(), userEntity.getPassword()........); return customUser; }
@Service @Transactional public class UserLoginService implements UserDetailsService { @Autowired private UserService userService; @Override public UserDetails loadUserByUsername(String userId) throws UsernameNotFoundException { UserEntity userEntity = this.userService.getUserByUserId(userId); if (userEntity == null) { throw new UsernameNotFoundException("User not found"); } UserLoginBean bean = new UserLoginBean(userEntity.getId(), userEntity.getUserId(), userEntity.getPassword(), userEntity.getEnabled()); bean.setFullname(userEntity.getFullname()); bean.setUserEntity(userEntity); Set<GrantedAuthority> roles = new HashSet<GrantedAuthority>(); roles.add( new SimpleGrantedAuthority( userEntity.getRole() ) ); bean.setAuthorities(roles); return bean; } }
protected boolean matchPassword(String password, UserEntity user) { String saltedPassword = saltPassword(password, user.getSalt()); return Context.getProcessEngineConfiguration() .getPasswordManager() .check(saltedPassword, user.getPassword()); }