@Override public UnifiedUser add(String username, String ip) { UnifiedUser unifiedUser = new UnifiedUser(ip, null, username); unifiedUser.init(); unifiedUser.setId(dao.add(unifiedUser)); return unifiedUser; }
@Override public UnifiedUser add(String username, String password, String ip) { UnifiedUser unifiedUser = new UnifiedUser(ip, pwdEncoder.encodePassword(password), username); unifiedUser.init(); unifiedUser.setId(dao.add(unifiedUser)); return unifiedUser; }
@Override public UnifiedUser login(String username, String password) throws UsernameNotFoundException, BadCredentialsException { UnifiedUser user = getByUsername(username); if (user == null) { throw new UsernameNotFoundException("username not found: " + username); } if (!pwdEncoder.isPasswordValid(user.getPassword(), password)) { throw new BadCredentialsException("password invalid"); } return user; }