use of com.springboot.cli.domain.User in project springboot-cli by liangqiding.
the class UserRealm method doGetAuthenticationInfo.
/**
* 认证
* 此处实现我们的登录逻辑,如账号密码验证
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
// 获取到token
UsernamePasswordToken token = (UsernamePasswordToken) authenticationToken;
// 从token中获取到用户名和密码
String username = token.getUsername();
String password = String.valueOf(token.getPassword());
// 为了方便,这里模拟获取用户
User user = this.getUser();
if (!user.getUsername().equals(username)) {
throw new UnknownAccountException("用户不存在");
} else if (!user.getPassword().equals(password)) {
throw new IncorrectCredentialsException("密码错误");
}
// 校验完成后,此处我们把用户信息返回,便于后面我们通过Subject获取用户的登录信息
return new SimpleAuthenticationInfo(user, password, getName());
}
use of com.springboot.cli.domain.User in project springboot-cli by liangqiding.
the class UserServiceImpl method updUser.
@Override
public boolean updUser(User user) {
StrUtil.isNotBlank(user.getPassword());
UpdateWrapper<User> set = new UpdateWrapper<User>().eq("user_id", user.getUserId()).set(StrUtil.isNotBlank(user.getPassword()), "password", user.getPassword()).set(StrUtil.isNotBlank(user.getUsername()), "username", user.getUsername()).set("updated_date", new Date());
return this.update(set);
}
use of com.springboot.cli.domain.User in project springboot-cli by liangqiding.
the class MybatisGenerationApplicationTests method listUser.
@Test
void listUser() {
List<User> users = userService.listUser(new User());
System.out.println(JSON.toJSONString(users));
}
Aggregations