perf:TokenBean移除无用的属性

This commit is contained in:
曾文豪
2024-08-07 23:43:57 +08:00
parent 316909dd61
commit 82d3f471f9
2 changed files with 7 additions and 27 deletions

View File

@@ -32,11 +32,13 @@ public class DemoWebConfigurer implements TieshengWebConfigurer, TsLoginConfigur
public TokenBean login(CorePlatformUnique platformUnique) {
TokenBean tokenBean = null;
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
tokenBean = new TokenBean(platformUnique.getUserId(), "", globalConfig.getService());
tokenBean = new TokenBean(platformUnique.getUserId(), "super");
} else if (Objects.equals(platformUnique.getUniqueId(), "1110290049")) {
tokenBean = new TokenBean("1", "", globalConfig.getService());
tokenBean = new TokenBean("1", "super");
}
if (tokenBean != null) {
tokenBean.setExtra("1110290049");
tokenBean.setRoleId("super");
}
return tokenBean;

View File

@@ -12,19 +12,15 @@ import com.tiesheng.util.config.TsTokenConfig;
public class TokenBean {
private String id;
private String environmentType;
private String service;
private String roleId;
private String extra;
public TokenBean() {
}
public TokenBean(String id, String environmentType, String service) {
public TokenBean(String id, String roleId) {
this.id = id;
this.environmentType = environmentType;
this.service = service;
this.roleId = "";
this.roleId = roleId;
this.extra = "";
}
@@ -37,8 +33,6 @@ public class TokenBean {
return JWT.create()
.setExpiresAt(DateUtil.offsetHour(DateUtil.date(), tsTokenConfig.getExpireHours()))
.setPayload("id", getId())
.setPayload("environmentType", StrUtil.emptyToDefault(getEnvironmentType(), ""))
.setPayload("service", StrUtil.emptyToDefault(getService(), ""))
.setPayload("roleId", StrUtil.emptyToDefault(getRoleId(), ""))
.setPayload("extra", StrUtil.emptyToDefault(getExtra(), ""))
.setKey(tsTokenConfig.getEncryptKey().getBytes())
@@ -57,22 +51,6 @@ public class TokenBean {
this.id = id;
}
public String getEnvironmentType() {
return environmentType;
}
public void setEnvironmentType(String environmentType) {
this.environmentType = environmentType;
}
public String getService() {
return service;
}
public void setService(String service) {
this.service = service;
}
public String getExtra() {
return extra;
}