增加clientId
This commit is contained in:
parent
16779413a6
commit
7a961d63a6
@ -139,6 +139,7 @@ public class LoginUser implements Serializable {
|
||||
* 是否是超级管理员
|
||||
*/
|
||||
private Integer isAdmin;
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 获取登录id
|
||||
|
||||
@ -46,6 +46,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
loginUser.setPassword(sysUser.getPassword());
|
||||
loginUser.setIsAdmin(sysUser.getIsAdmin());
|
||||
loginUser.setRoleId(sysUser.getRoleId());
|
||||
loginUser.setClientId(sysUser.getClientId());
|
||||
|
||||
return loginUser;
|
||||
}
|
||||
|
||||
@ -80,6 +80,8 @@ public class AuthController {
|
||||
ConfigVO configVO = new ConfigVO();
|
||||
String property = SpringUtil.getProperty("security.captcha.enabled");
|
||||
configVO.setIsCaptchaOn(Boolean.parseBoolean(property));
|
||||
configVO.setIsPhoneRegisterOn(Boolean.parseBoolean(SpringUtil.getProperty("security.register.phoneEnabled")));
|
||||
configVO.setClientId(SpringUtil.getProperty("security.clientId"));
|
||||
return R.ok(configVO);
|
||||
}
|
||||
|
||||
|
||||
@ -5,4 +5,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ConfigVO {
|
||||
private Boolean isCaptchaOn;
|
||||
private Boolean isPhoneRegisterOn;
|
||||
private String clientId;
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.agileboot.auth.properties.CaptchaProperties;
|
||||
import com.agileboot.auth.service.IAuthStrategy;
|
||||
import com.agileboot.auth.service.SysLoginService;
|
||||
import com.agileboot.common.core.enums.LoginType;
|
||||
import com.agileboot.common.core.exception.BizException;
|
||||
import com.agileboot.common.core.utils.ValidatorUtils;
|
||||
import com.agileboot.common.satoken.pojo.LoginUser;
|
||||
import com.agileboot.common.satoken.utils.LoginHelper;
|
||||
@ -23,6 +24,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 密码认证策略
|
||||
*
|
||||
@ -54,6 +57,9 @@ public class PasswordAuthStrategy implements IAuthStrategy {
|
||||
|
||||
|
||||
LoginUser loginUser = userService.getUserInfo(username);
|
||||
if (!Objects.equals(loginUser.getClientId(), client.getClientId())) {
|
||||
throw new BizException("client.not.match");
|
||||
}
|
||||
loginService.checkLogin(LoginType.PASSWORD, null, loginUser.getUsername(), () -> false);
|
||||
|
||||
loginUser.setClientKey(client.getClientKey());
|
||||
|
||||
@ -71,6 +71,7 @@ user:
|
||||
|
||||
# 安全配置
|
||||
security:
|
||||
clientId: 1
|
||||
# 验证码
|
||||
captcha:
|
||||
# 是否开启验证码
|
||||
@ -83,6 +84,9 @@ security:
|
||||
numberLength: 0
|
||||
# 字符验证码长度
|
||||
charLength: 5
|
||||
# 注册
|
||||
register:
|
||||
phoneEnabled: false
|
||||
|
||||
|
||||
# redisson 配置
|
||||
|
||||
@ -112,4 +112,5 @@ public class SysUser extends BaseEntity {
|
||||
* 超级管理员标志(1是,0否)
|
||||
*/
|
||||
private Integer isAdmin;
|
||||
private String clientId;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user