【7.1.6】新增资源汇报token有效期时间设置

pull/25/MERGE
rays 2022-01-21 11:26:16 +08:00
parent ad8f1fd751
commit f97c24cdc8
2 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,11 @@ public class DevOpsReportProperties {
*/
private String projectInteractionSecretKey;
/**
* Token
*/
private Long tokenValidityPeriodSeconds;
/**
* FieldMetadata
* <p>

View File

@ -287,7 +287,6 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
this.remove(wrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void reportResources(@RequestBody ReportResourceParam reportResourceReq) {
@ -414,9 +413,10 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
// jwt token生成
String projectInteractionSecretKey = devOpsReportProperties.getProjectInteractionSecretKey();
Long tokenValidityPeriodSeconds = devOpsReportProperties.getTokenValidityPeriodSeconds();
JwtConfig jwtConfig = new JwtConfig();
jwtConfig.setJwtSecret(projectInteractionSecretKey);
jwtConfig.setExpiredSeconds(DEVOPS_REPORT_TIMEOUT_SECONDS);
jwtConfig.setExpiredSeconds(ObjectUtil.isNotEmpty(tokenValidityPeriodSeconds) ? tokenValidityPeriodSeconds : DEVOPS_REPORT_TIMEOUT_SECONDS);
JwtTokenOperator jwtTokenOperator = new JwtTokenOperator(jwtConfig);
String jwtToken = jwtTokenOperator.generateToken(new HashMap<>());