mirror of
https://gitee.com/dromara/dax-pay
synced 2026-08-09 14:36:00 +08:00
refactor(system): 开源版移除异常登录检测配置(转商业版)
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
"security_password_policy": "Password policy",
|
||||
"security_login": "Login security",
|
||||
"security_session": "Session management",
|
||||
"anomaly_detection": "Anomaly login detection",
|
||||
"security_two_factor_auth": "Two-factor authentication",
|
||||
"url": "System URL settings",
|
||||
"wechat_notify": "WeChat message notify template config"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
"security_password_policy": "密码策略配置",
|
||||
"security_login": "登录安全配置",
|
||||
"security_session": "会话管理配置",
|
||||
"anomaly_detection": "异常登录检测配置",
|
||||
"security_two_factor_auth": "双因素认证配置",
|
||||
"url": "系统访问地址配置",
|
||||
"wechat_notify": "微信消息通知模板配置"
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/// # 平台安全配置
|
||||
///
|
||||
/// 管理密码策略、登录安全、会话管理、异常登录检测、双因素认证等安全类配置
|
||||
/// 管理密码策略、登录安全、会话管理、双因素认证等安全类配置
|
||||
@PermCode(menuCode = "system:security_config")
|
||||
@Validated
|
||||
@Tag(name = "平台安全配置")
|
||||
@@ -77,21 +77,6 @@ public class PlatformSecurityConfigController {
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@PermCode(code = "view", nameCn = "安全配置查看", nameEn = "Security View")
|
||||
@Operation(summary = "获取异常登录检测配置")
|
||||
@GetMapping("/anomaly-detection/get")
|
||||
public Result<PlatformAnomalyDetectionConfigResult> getAnomalyDetectionConfig() {
|
||||
return Res.ok(platformSecurityConfigService.findAnomalyDetectionConfig());
|
||||
}
|
||||
|
||||
@PermCode(code = "manage", nameCn = "安全配置管理", nameEn = "Security Manage")
|
||||
@Operation(summary = "更新异常登录检测配置")
|
||||
@PostMapping("/anomaly-detection/update")
|
||||
public Result<Void> updateAnomalyDetectionConfig(@RequestBody @Validated PlatformAnomalyDetectionConfigParam param) {
|
||||
platformSecurityConfigService.updateAnomalyDetectionConfig(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@PermCode(code = "view", nameCn = "安全配置查看", nameEn = "Security View")
|
||||
@Operation(summary = "获取双因素认证配置")
|
||||
@GetMapping("/two-factor-auth/get")
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.mapstruct.factory.Mappers;
|
||||
|
||||
/// # 平台安全配置转换
|
||||
///
|
||||
/// 转换密码策略、登录安全、会话管理、异常登录检测、双因素认证等安全类配置
|
||||
/// 转换密码策略、登录安全、会话管理、双因素认证等安全类配置
|
||||
@Mapper
|
||||
public interface PlatformSecurityConfigConvert {
|
||||
PlatformSecurityConfigConvert CONVERT = Mappers.getMapper(PlatformSecurityConfigConvert.class);
|
||||
@@ -29,11 +29,6 @@ public interface PlatformSecurityConfigConvert {
|
||||
|
||||
void copy(PlatformSessionManagementConfigParam param, @MappingTarget PlatformSessionManagementConfig data);
|
||||
|
||||
// ========== 异常登录检测配置转换 ==========
|
||||
PlatformAnomalyDetectionConfigResult toAnomalyDetectionResult(PlatformAnomalyDetectionConfig data);
|
||||
|
||||
void copy(PlatformAnomalyDetectionConfigParam param, @MappingTarget PlatformAnomalyDetectionConfig data);
|
||||
|
||||
// ========== 双因素认证配置转换 ==========
|
||||
PlatformTwoFactorAuthConfigResult toTwoFactorAuthResult(PlatformTwoFactorAuthConfig data);
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package cn.daxpay.open.platform.system.entity.config.platform.security;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/// # 异常登录检测配置
|
||||
///
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PlatformAnomalyDetectionConfig {
|
||||
|
||||
/// 是否启用异常登录检测
|
||||
private Boolean enabled;
|
||||
/// 是否检测异常IP
|
||||
private Boolean detectAnomalousIp;
|
||||
/// IP风险阈值(0-100)
|
||||
private Integer ipRiskThreshold;
|
||||
/// 是否检测异常登录时间
|
||||
private Boolean detectAnomalousTime;
|
||||
/// 登录时间偏离阈值(小时)
|
||||
private Integer timeDeviationThreshold;
|
||||
/// 是否检测异常设备
|
||||
private Boolean detectAnomalousDevice;
|
||||
/// 检测到异常登录时是否拦截
|
||||
private Boolean blockOnAnomaly;
|
||||
}
|
||||
@@ -19,8 +19,6 @@ public enum PlatformConfigTypeEnum implements I18nSupport {
|
||||
SECURITY_LOGIN("security_login"),
|
||||
/// 会话管理配置
|
||||
SECURITY_SESSION("security_session"),
|
||||
/// 异常登录检测配置
|
||||
ANOMALY_DETECTION("anomaly_detection"),
|
||||
/// 双因素认证配置
|
||||
SECURITY_TWO_FACTOR_AUTH("security_two_factor_auth"),
|
||||
/// 系统访问地址配置
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package cn.daxpay.open.platform.system.param.config.security;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/// # 异常登录检测配置参数
|
||||
///
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "异常登录检测配置参数")
|
||||
public class PlatformAnomalyDetectionConfigParam {
|
||||
|
||||
@Schema(description = "是否启用异常登录检测")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "是否检测异常IP")
|
||||
private Boolean detectAnomalousIp;
|
||||
|
||||
@Schema(description = "IP风险阈值(0-100)")
|
||||
private Integer ipRiskThreshold;
|
||||
|
||||
@Schema(description = "是否检测异常登录时间")
|
||||
private Boolean detectAnomalousTime;
|
||||
|
||||
@Schema(description = "登录时间偏离阈值(小时)")
|
||||
private Integer timeDeviationThreshold;
|
||||
|
||||
@Schema(description = "是否检测异常设备")
|
||||
private Boolean detectAnomalousDevice;
|
||||
|
||||
@Schema(description = "检测到异常登录时是否拦截")
|
||||
private Boolean blockOnAnomaly;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package cn.daxpay.open.platform.system.result.config.security;
|
||||
|
||||
import cn.daxpay.open.platform.core.result.BaseResult;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/// # 异常登录检测配置结果
|
||||
///
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "异常登录检测配置结果")
|
||||
public class PlatformAnomalyDetectionConfigResult extends BaseResult {
|
||||
|
||||
@Schema(description = "是否启用异常登录检测")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(description = "是否检测异常IP")
|
||||
private Boolean detectAnomalousIp;
|
||||
|
||||
@Schema(description = "IP风险阈值(0-100)")
|
||||
private Integer ipRiskThreshold;
|
||||
|
||||
@Schema(description = "是否检测异常登录时间")
|
||||
private Boolean detectAnomalousTime;
|
||||
|
||||
@Schema(description = "登录时间偏离阈值(小时)")
|
||||
private Integer timeDeviationThreshold;
|
||||
|
||||
@Schema(description = "是否检测异常设备")
|
||||
private Boolean detectAnomalousDevice;
|
||||
|
||||
@Schema(description = "检测到异常登录时是否拦截")
|
||||
private Boolean blockOnAnomaly;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
/// # 平台安全配置服务
|
||||
///
|
||||
/// 统一管理密码策略、登录安全、会话管理、异常登录检测、双因素认证等安全类配置
|
||||
/// 统一管理密码策略、登录安全、会话管理、双因素认证等安全类配置
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -77,25 +77,6 @@ public class PlatformSecurityConfigService {
|
||||
systemConfigService.updateConfig(PlatformConfigTypeEnum.SECURITY_SESSION, data);
|
||||
}
|
||||
|
||||
/// 获取异常登录检测配置
|
||||
public PlatformAnomalyDetectionConfig getAnomalyDetectionConfig() {
|
||||
return systemConfigService.getOrCreateConfig(PlatformConfigTypeEnum.ANOMALY_DETECTION,
|
||||
PlatformAnomalyDetectionConfig.class,
|
||||
new PlatformAnomalyDetectionConfig());
|
||||
}
|
||||
|
||||
/// 获取异常登录检测配置
|
||||
public PlatformAnomalyDetectionConfigResult findAnomalyDetectionConfig() {
|
||||
return PlatformSecurityConfigConvert.CONVERT.toAnomalyDetectionResult(this.getAnomalyDetectionConfig());
|
||||
}
|
||||
|
||||
/// 更新异常登录检测配置
|
||||
public void updateAnomalyDetectionConfig(PlatformAnomalyDetectionConfigParam param) {
|
||||
PlatformAnomalyDetectionConfig data = this.getAnomalyDetectionConfig();
|
||||
PlatformSecurityConfigConvert.CONVERT.copy(param, data);
|
||||
systemConfigService.updateConfig(PlatformConfigTypeEnum.ANOMALY_DETECTION, data);
|
||||
}
|
||||
|
||||
/// 获取双因素认证配置
|
||||
public PlatformTwoFactorAuthConfig getTwoFactorAuthConfig() {
|
||||
return systemConfigService.getOrCreateConfig(PlatformConfigTypeEnum.SECURITY_TWO_FACTOR_AUTH,
|
||||
|
||||
Reference in New Issue
Block a user