feat(auth): implement custom user details and enhance JWT token payload

- Introduce CustomUserDetails to encapsulate user information and authorities
- Remove redundant UserProfileResponse from AuthTokenResponse
- Add userId, nickname, and avatar claims to JWT token generation
- Update UserDetailsServiceImpl to use CustomUserDetails
- Modify JwtTokenUtil to accept CustomUserDetails and include additional claims
- Add avatar field to User entity
- Update UserMapper to map avatar field in result mappings
- Add logging for successful and failed login attempts
This commit is contained in:
Chaos
2025-11-25 16:53:43 +08:00
parent a5a23a6b52
commit 2a94f493e6
7 changed files with 117 additions and 31 deletions

View File

@@ -40,6 +40,11 @@ public class User {
*/
private String nickname;
/**
* 头像
*/
private String avatar;
/**
* 状态 (1:启用, 0:禁用)
*/

View File

@@ -6,5 +6,4 @@ import lombok.Data;
public class AuthTokenResponse {
private String tokenHead;
private String token;
private UserProfileResponse userProfile;
}