refactor: 适配 ContiNew Starter 脱敏模块(安全模块)
This commit is contained in:
parent
dc5425dd67
commit
2109789116
@ -96,6 +96,12 @@
|
|||||||
<artifactId>continew-starter-file-excel</artifactId>
|
<artifactId>continew-starter-file-excel</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- ContiNew Starter 安全模块 - 脱敏 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>top.charles7c.continew</groupId>
|
||||||
|
<artifactId>continew-starter-security-mask</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- ContiNew Starter 安全模块 - 密码编码器 -->
|
<!-- ContiNew Starter 安全模块 - 密码编码器 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.charles7c.continew</groupId>
|
<groupId>top.charles7c.continew</groupId>
|
||||||
|
@ -16,11 +16,12 @@
|
|||||||
|
|
||||||
package top.charles7c.continew.admin.auth.model.resp;
|
package top.charles7c.continew.admin.auth.model.resp;
|
||||||
|
|
||||||
import cn.hutool.core.util.DesensitizedUtil;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import top.charles7c.continew.admin.common.enums.GenderEnum;
|
import top.charles7c.continew.admin.common.enums.GenderEnum;
|
||||||
|
import top.charles7c.continew.starter.security.mask.annotation.JsonMask;
|
||||||
|
import top.charles7c.continew.starter.security.mask.enums.MaskType;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -68,13 +69,15 @@ public class UserInfoResp implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 邮箱
|
* 邮箱
|
||||||
*/
|
*/
|
||||||
@Schema(description = "邮箱", example = "123456789@qq.com")
|
@Schema(description = "邮箱", example = "c*******@126.com")
|
||||||
|
@JsonMask(MaskType.EMAIL)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号码
|
* 手机号码
|
||||||
*/
|
*/
|
||||||
@Schema(description = "手机号码", example = "13811111111")
|
@Schema(description = "手机号码", example = "188****8888")
|
||||||
|
@JsonMask(MaskType.MOBILE_PHONE)
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,14 +134,6 @@ public class UserInfoResp implements Serializable {
|
|||||||
@Schema(description = "角色编码集合", example = "[\"test\"]")
|
@Schema(description = "角色编码集合", example = "[\"test\"]")
|
||||||
private Set<String> roles;
|
private Set<String> roles;
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return DesensitizedUtil.email(email);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhone() {
|
|
||||||
return DesensitizedUtil.mobilePhone(phone);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getRegistrationDate() {
|
public LocalDate getRegistrationDate() {
|
||||||
return createTime.toLocalDate();
|
return createTime.toLocalDate();
|
||||||
}
|
}
|
||||||
|
@ -16,19 +16,17 @@
|
|||||||
|
|
||||||
package top.charles7c.continew.admin.system.model.resp;
|
package top.charles7c.continew.admin.system.model.resp;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
import cn.hutool.core.util.DesensitizedUtil;
|
|
||||||
|
|
||||||
import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum;
|
import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum;
|
||||||
import top.charles7c.continew.admin.common.enums.GenderEnum;
|
import top.charles7c.continew.admin.common.enums.GenderEnum;
|
||||||
import top.charles7c.continew.admin.common.util.helper.LoginHelper;
|
import top.charles7c.continew.admin.common.util.helper.LoginHelper;
|
||||||
import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp;
|
import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp;
|
||||||
|
import top.charles7c.continew.starter.security.mask.annotation.JsonMask;
|
||||||
|
import top.charles7c.continew.starter.security.mask.enums.MaskType;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
@ -70,13 +68,15 @@ public class UserResp extends BaseResp {
|
|||||||
/**
|
/**
|
||||||
* 邮箱
|
* 邮箱
|
||||||
*/
|
*/
|
||||||
@Schema(description = "邮箱", example = "123456789@qq.com")
|
@Schema(description = "邮箱", example = "c*******@126.com")
|
||||||
|
@JsonMask(MaskType.EMAIL)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号码
|
* 手机号码
|
||||||
*/
|
*/
|
||||||
@Schema(description = "手机号码", example = "13811111111")
|
@Schema(description = "手机号码", example = "188****8888")
|
||||||
|
@JsonMask(MaskType.MOBILE_PHONE)
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,14 +97,6 @@ public class UserResp extends BaseResp {
|
|||||||
@Schema(description = "描述", example = "张三描述信息")
|
@Schema(description = "描述", example = "张三描述信息")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return DesensitizedUtil.email(email);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhone() {
|
|
||||||
return DesensitizedUtil.mobilePhone(phone);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean getDisabled() {
|
public Boolean getDisabled() {
|
||||||
return this.getIsSystem() || Objects.equals(this.getId(), LoginHelper.getUserId());
|
return this.getIsSystem() || Objects.equals(this.getId(), LoginHelper.getUserId());
|
||||||
|
Loading…
Reference in New Issue
Block a user