mirror of https://gitee.com/stylefeng/roses
【7.1.6】新增资源汇报token有效期时间设置
parent
ad8f1fd751
commit
f97c24cdc8
|
@ -27,6 +27,11 @@ public class DevOpsReportProperties {
|
||||||
*/
|
*/
|
||||||
private String projectInteractionSecretKey;
|
private String projectInteractionSecretKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Token的有效期
|
||||||
|
*/
|
||||||
|
private Long tokenValidityPeriodSeconds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FieldMetadata类的全路径
|
* FieldMetadata类的全路径
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -287,7 +287,6 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
|
||||||
this.remove(wrapper);
|
this.remove(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void reportResources(@RequestBody ReportResourceParam reportResourceReq) {
|
public void reportResources(@RequestBody ReportResourceParam reportResourceReq) {
|
||||||
|
@ -414,9 +413,10 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
|
||||||
|
|
||||||
// jwt token生成
|
// jwt token生成
|
||||||
String projectInteractionSecretKey = devOpsReportProperties.getProjectInteractionSecretKey();
|
String projectInteractionSecretKey = devOpsReportProperties.getProjectInteractionSecretKey();
|
||||||
|
Long tokenValidityPeriodSeconds = devOpsReportProperties.getTokenValidityPeriodSeconds();
|
||||||
JwtConfig jwtConfig = new JwtConfig();
|
JwtConfig jwtConfig = new JwtConfig();
|
||||||
jwtConfig.setJwtSecret(projectInteractionSecretKey);
|
jwtConfig.setJwtSecret(projectInteractionSecretKey);
|
||||||
jwtConfig.setExpiredSeconds(DEVOPS_REPORT_TIMEOUT_SECONDS);
|
jwtConfig.setExpiredSeconds(ObjectUtil.isNotEmpty(tokenValidityPeriodSeconds) ? tokenValidityPeriodSeconds : DEVOPS_REPORT_TIMEOUT_SECONDS);
|
||||||
JwtTokenOperator jwtTokenOperator = new JwtTokenOperator(jwtConfig);
|
JwtTokenOperator jwtTokenOperator = new JwtTokenOperator(jwtConfig);
|
||||||
String jwtToken = jwtTokenOperator.generateToken(new HashMap<>());
|
String jwtToken = jwtTokenOperator.generateToken(new HashMap<>());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue