|
@@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.eco.vip.auth.domain.auth.pojo.AuthQuery;
|
|
|
import org.eco.vip.auth.domain.auth.pojo.AuthVO;
|
|
|
+import org.eco.vip.auth.domain.client.pojo.ClientVO;
|
|
|
import org.eco.vip.auth.domain.user.pojo.UserVO;
|
|
|
import org.eco.vip.auth.service.user.IUserService;
|
|
|
import org.eco.vip.orm.enums.UserStatus;
|
|
@@ -37,36 +38,39 @@ public class PasswordAuthStrategy implements IAuthStrategy {
|
|
|
@Resource
|
|
|
IUserService userService;
|
|
|
@Override
|
|
|
- public AuthVO login(AuthQuery authQuery) {
|
|
|
+ public AuthVO login(AuthQuery authQuery, ClientVO clientVO) {
|
|
|
String tenantId = authQuery.getTenantId();
|
|
|
String account = authQuery.getAccount();
|
|
|
String password = authQuery.getPassword();
|
|
|
+ // 不做验证码校验
|
|
|
String code = authQuery.getCode();
|
|
|
- String uuid = authQuery.getUuid();
|
|
|
|
|
|
- UserVO userVO = getUserByAccount(tenantId, account);
|
|
|
+ UserVO userVO = buildUserVO(tenantId, account);
|
|
|
|
|
|
- LoginUser loginUser = new LoginUser();
|
|
|
- loginUser.setUserId("sdsd");
|
|
|
- loginUser.setUserType("pc");
|
|
|
- SaLoginParameter loginParameter = createLoginModel();
|
|
|
+ // 构建登录信息
|
|
|
+ LoginUser loginUser = LoginUser.builder()
|
|
|
+ .userId(userVO.getUserId())
|
|
|
+ .userType(userVO.getUserType())
|
|
|
+ .deviceType(clientVO.getDeviceType())
|
|
|
+ .clientKey(clientVO.getClientKey())
|
|
|
+ .orgId(userVO.getOrgId())
|
|
|
+ .build();
|
|
|
+
|
|
|
+ SaLoginParameter loginParameter = createLoginModel(clientVO);
|
|
|
LoginHelper.login(loginUser, loginParameter);
|
|
|
- AuthVO authVO = new AuthVO();
|
|
|
- authVO.setAccessToken(StpUtil.getTokenValue());
|
|
|
- authVO.setExpireIn(StpUtil.getTokenTimeout());
|
|
|
- return authVO;
|
|
|
+ return AuthVO.builder().accessToken(StpUtil.getTokenValue()).expireIn(StpUtil.getTokenTimeout()).build();
|
|
|
}
|
|
|
|
|
|
- private static SaLoginParameter createLoginModel() {
|
|
|
+ private static SaLoginParameter createLoginModel(ClientVO clientVO) {
|
|
|
SaLoginParameter loginParameter = new SaLoginParameter();
|
|
|
- loginParameter.setDeviceType("pc");
|
|
|
- loginParameter.setTimeout(10);
|
|
|
- loginParameter.setActiveTimeout(30);
|
|
|
- loginParameter.setExtra(LoginHelper.CLIENT_KEY, "");
|
|
|
+ loginParameter.setDeviceType(clientVO.getDeviceType());
|
|
|
+ loginParameter.setTimeout(clientVO.getTimeout());
|
|
|
+ loginParameter.setActiveTimeout(clientVO.getActiveTimeout());
|
|
|
+ loginParameter.setExtra(LoginHelper.CLIENT_KEY, clientVO.getClientKey());
|
|
|
return loginParameter;
|
|
|
}
|
|
|
|
|
|
- private UserVO getUserByAccount(String tenantId, String account) {
|
|
|
+ private UserVO buildUserVO(String tenantId, String account) {
|
|
|
UserVO userVO = userService.selectTenantUserByUserName(tenantId, account);
|
|
|
if (ObjUtils.isNull(userVO)) {
|
|
|
log.info("登录账号:{} 不存在.", account);
|