feat(jwt): extend token expiration time and improve authentication filter
- Extend JWT token expiration from 1 hour to 30 days - Improve Authorization header validation in authentication filter - Add null check for header before calling startsWith method - Import Strings utility class for better string handling
This commit is contained in:
@@ -80,7 +80,7 @@ public class JwtTokenHelper implements InitializingBean {
|
||||
*/
|
||||
public String generateToken(String username) {
|
||||
Instant now = Instant.now();
|
||||
Instant expireTime = now.plus(1, ChronoUnit.HOURS);
|
||||
Instant expireTime = now.plus(30, ChronoUnit.DAYS);
|
||||
|
||||
return Jwts.builder()
|
||||
.header().add("type", "JWT").and() // 推荐添加 header
|
||||
|
||||
Reference in New Issue
Block a user