1. app登录时用openid查询

This commit is contained in:
邱贞招 2024-06-19 11:36:19 +08:00
parent e41cf73a7b
commit 127dd794d0
2 changed files with 4 additions and 4 deletions

View File

@ -252,7 +252,7 @@ public class SysLoginService
}
Authentication authentication = null; // 用户验证
try {
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getUserName(), Constants.CUSTOM_LOGIN_WX);
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getWxopenid(), Constants.CUSTOM_LOGIN_WX);
// 用户名和密码等信息保存在一个上下文中只要是同一线程等会就能拿到用户名和密码也就是能在loadUserByUsername(String username)方法中进行密码验证等
AuthenticationContextHolder.setContext(authenticationToken);
// 把用户类型放在上下文中的details属性中在UserDetailsServiceImpl.loadUserByUsername中获取
@ -305,7 +305,7 @@ public class SysLoginService
}
Authentication authentication = null; // 用户验证
try {
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getUserName(), Constants.CUSTOM_LOGIN_WX);
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getWxopenid(), Constants.CUSTOM_LOGIN_WX);
// 用户名和密码等信息保存在一个上下文中只要是同一线程等会就能拿到用户名和密码也就是能在loadUserByUsername(String username)方法中进行密码验证等
AuthenticationContextHolder.setContext(authenticationToken);
// 把用户类型放在上下文中的details属性中在UserDetailsServiceImpl.loadUserByUsername中获取

View File

@ -74,8 +74,8 @@ public class UserDetailsServiceImpl implements UserDetailsService
return createLoginUser(user);
}else {
// app用户登录
AsUser user = asUserService.selectUserByUserName(username);
// app用户登录 如果是app用户则用openid查询
AsUser user = asUserService.selectUserByWxopenid(username);
if (StringUtils.isNull(user))
{
log.info("登录用户:{} 不存在.", username);