文件生成补充

This commit is contained in:
nojava
2026-05-17 17:44:07 +08:00
parent 1d24901bd4
commit 47f29012d2
166 changed files with 2651 additions and 3 deletions
@@ -19,13 +19,13 @@ public class JwtTokenProvider {
private final JwtProperties jwtProperties;
public String generateAccessToken(Long userId, String role) {
public String generateAccessToken(Long userId, Integer role) {
Date now = new Date();
Date expiryDate = new Date(now.getTime() + jwtProperties.getAccessTokenExpire() * 1000);
return Jwts.builder()
.subject(String.valueOf(userId))
.claim("role", role)
.claim("role", String.valueOf(role))
.issuedAt(now)
.expiration(expiryDate)
.signWith(jwtProperties.getSigningKey())
@@ -40,4 +40,8 @@ public class TokenBlacklistService {
String key = SecurityConstants.REFRESH_TOKEN_KEY + userId;
redisTemplate.delete(key);
}
public void addToBlacklist(String token) {
blacklistAccessToken(token, 7200);
}
}