Feat/token provider - #411
Conversation
Signed-off-by: hgkim <hgkim@openerd.com>
…iguration Signed-off-by: hgkim <hgkim@openerd.com>
|
There was a problem hiding this comment.
Pull Request Overview
This PR externalizes JWT settings into a new JwtProperties class, updates token expiration values via YAML, and adds TODO comments for future improvements in filter path handling.
- Introduce
JwtPropertieswith@ConfigurationPropertiesto manage JWT settings. - Move token expiration values to
application.ymland adjust the access token to 2 days. - Add TODOs in
JwtAuthenticationFilterfor annotation-based path configuration.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/resources/application.yml | Added access-token-expiration and refresh-token-expiration under security.jwt |
| src/main/java/app/bottlenote/global/security/jwt/JwtTokenProvider.java | Updated hardcoded expiration constants to 2 days for access and kept refresh at 14 days |
| src/main/java/app/bottlenote/global/security/jwt/JwtProperties.java | New configuration class for externalized JWT properties |
| src/main/java/app/bottlenote/global/security/jwt/JwtAuthenticationFilter.java | Added TODOs for annotation-based path management |
Comments suppressed due to low confidence (2)
src/main/resources/application.yml:63
- These new properties are at the same indentation level as
jwtinstead of nested under it. They should be indented two more spaces so they reside undersecurity.jwtfor the prefix mapping to work.
access-token-expiration: 86400 # 하루 (24시간)
src/main/resources/application.yml:64
- The YAML values appear to be in seconds, but the code multiplies constants by 1000 (milliseconds). Clarify or convert units consistently to avoid token lifespan mismatches.
refresh-token-expiration: 2592000 # 한 달 (30일)
| public static final int ACCESS_TOKEN_EXPIRE_TIME = 1000 * 60 * 60 * 24 * 2; | ||
| public static final int REFRESH_TOKEN_EXPIRE_TIME = 1000 * 60 * 60 * 24 * 14; |
There was a problem hiding this comment.
The class still uses static constants for expiration. Consider injecting JwtProperties and using its values here so the provider honors the externalized configuration.
| public static final int ACCESS_TOKEN_EXPIRE_TIME = 1000 * 60 * 60 * 24 * 2; | |
| public static final int REFRESH_TOKEN_EXPIRE_TIME = 1000 * 60 * 60 * 24 * 14; | |
| @Value("${security.jwt.access-token-expire-time}") | |
| private int accessTokenExpireTime; | |
| @Value("${security.jwt.refresh-token-expire-time}") | |
| private int refreshTokenExpireTime; |
| @AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| @ConfigurationProperties(prefix = "security.jwt") | ||
| @ConfigurationPropertiesScan |
There was a problem hiding this comment.
[nitpick] You’ve placed @ConfigurationPropertiesScan on this class. It's typically applied to a configuration entry point (e.g., the main application class) instead of the properties bean itself—consider relocating the scan annotation.
| @ConfigurationPropertiesScan |



This pull request introduces changes to improve the JWT authentication system by enhancing configurability, reducing hardcoded values, and improving maintainability. The most important changes include adding a
JwtPropertiesclass for externalized configuration, updating token expiration times, and introducing TODO comments for future improvements.Improvements to JWT Configuration:
JwtPropertiesclass added: Introduced a new classJwtPropertiesto externalize JWT-related configurations, such assecretKey,accessTokenExpiration, andrefreshTokenExpiration, using Spring's@ConfigurationPropertiesand@ConfigurationPropertiesScan. This enhances flexibility and maintainability.application.ymlto defineaccess-token-expirationandrefresh-token-expirationvalues, replacing hardcoded values in the code. This aligns with the newJwtPropertiesclass.Updates to JWT Token Behavior:
ACCESS_TOKEN_EXPIRE_TIMEto 2 days (from 24 hours) while keepingREFRESH_TOKEN_EXPIRE_TIMEunchanged at 14 days. This change may impact session management and user experience.Codebase Maintainability:
JwtAuthenticationFilterto suggest replacing the hardcoded path management system with an annotation-based approach (@AccessPolicyor@OptionalAuth) to reduce redundancy and improve scalability.