Ejemplo n.º 1
0
 @Override
 public UnifiedUser add(String username, String ip) {
   UnifiedUser unifiedUser = new UnifiedUser(ip, null, username);
   unifiedUser.init();
   unifiedUser.setId(dao.add(unifiedUser));
   return unifiedUser;
 }
Ejemplo n.º 2
0
 @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;
 }
Ejemplo n.º 3
0
 @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;
 }