feat(auth): implement JWT authentication

- Add JwtUtils for token generation and validation using jjwt
- Refactor AuthService.login to return User instead of Boolean
- Add jjwt dependencies and integrate JWT into login flow
- Externalize JWT secret, expiration, and log level as configurable env vars with defaults
This commit is contained in:
2026-05-21 14:04:00 +08:00
parent 3937224341
commit 44b8326e96
6 changed files with 108 additions and 21 deletions
+9 -5
View File
@@ -9,8 +9,8 @@ spring:
jackson:
default-property-inclusion: non_null
property-naming-strategy: SNAKE_CASE
date-format: ${JSON_DATE_FORMAT}
time-zone: ${JSON_TIME_ZONE}
date-format: ${JSON_DATE_FORMAT:}
time-zone: ${JSON_TIME_ZONE:}
mybatis-plus:
configuration:
@@ -18,6 +18,10 @@ mybatis-plus:
map-underscore-to-camel-case: true
# 开启日志输出sql语句
# log-impl: org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl
# logging:
# level:
# com.msksbr.bookmgr: "DEBUG"
logging:
level:
com.msksbr.bookmgr: ${LOG_LEVEL:INFO}
jwt:
secret: ${JWT_SECRET:}
expiration: ${JWT_EXPIRATION_TIME:86400000}