update 优化api,gateway,auth代码结构

This commit is contained in:
AprilWind
2024-01-19 16:57:17 +08:00
parent bf95012138
commit ef83f06f2b
35 changed files with 320 additions and 29 deletions

View File

@@ -59,11 +59,13 @@ public class CaptchaController {
// 生成验证码
CaptchaType captchaType = captchaProperties.getType();
boolean isMath = CaptchaType.MATH == captchaType;
//如果是则拿取数字验证码位数,如果不是则拿取字符验证码长度
Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength();
CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length);
AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz());
captcha.setGenerator(codeGenerator);
captcha.createCode();
// 如果是数学验证码使用SpEL表达式处理验证码结果
String code = captcha.getCode();
if (isMath) {
ExpressionParser parser = new SpelExpressionParser();

View File

@@ -10,10 +10,19 @@ import lombok.Data;
@Data
public class TenantListVo {
/**
* 租户编号
*/
private String tenantId;
/**
* 企业名称
*/
private String companyName;
/**
* 域名
*/
private String domain;
}

View File

@@ -11,7 +11,6 @@ import org.dromara.common.core.domain.model.LoginBody;
*
* @author Lion Li
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class EmailLoginBody extends LoginBody {

View File

@@ -31,6 +31,9 @@ public class RegisterBody extends LoginBody {
@Length(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}")
private String password;
/**
* 用户类型
*/
private String userType;
}

View File

@@ -10,7 +10,6 @@ import org.dromara.common.core.domain.model.LoginBody;
*
* @author Lion Li
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SmsLoginBody extends LoginBody {

View File

@@ -10,7 +10,6 @@ import org.dromara.common.core.domain.model.LoginBody;
*
* @author Lion Li
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SocialLoginBody extends LoginBody {

View File

@@ -10,7 +10,6 @@ import org.dromara.common.core.domain.model.LoginBody;
*
* @author Lion Li
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class XcxLoginBody extends LoginBody {

View File

@@ -17,6 +17,7 @@ import org.springframework.context.annotation.Configuration;
@RefreshScope
@ConfigurationProperties(prefix = "security.captcha")
public class CaptchaProperties {
/**
* 验证码类型
*/

View File

@@ -16,6 +16,11 @@ public interface IAuthStrategy {
/**
* 登录
*
* @param body 登录对象
* @param client 授权管理视图对象
* @param grantType 授权类型
* @return 登录验证信息
*/
static LoginVo login(String body, RemoteClientVo client, String grantType) {
// 授权类型和客户端id
@@ -29,6 +34,10 @@ public interface IAuthStrategy {
/**
* 登录
*
* @param body 登录对象
* @param client 授权管理视图对象
* @return 登录验证信息
*/
LoginVo login(String body, RemoteClientVo client);