feat: add About Me dialog showing user info, roles, and groups
- Add GET /api/v1/auth/me endpoint returning current user's UserDetail - Add AboutMeDialog component with role badges and group memberships - Add userMenuItems prop to TopBar via design-system update - Wire "About Me" menu item into user dropdown above Logout Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import com.cameleer3.server.core.admin.AuditResult;
|
||||
import com.cameleer3.server.core.admin.AuditService;
|
||||
import com.cameleer3.server.core.rbac.RbacService;
|
||||
import com.cameleer3.server.core.rbac.SystemRole;
|
||||
import com.cameleer3.server.core.rbac.UserDetail;
|
||||
import com.cameleer3.server.core.security.JwtService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import com.cameleer3.server.core.security.JwtService.JwtValidationResult;
|
||||
@@ -22,6 +23,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -149,6 +152,21 @@ public class UiAuthController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/me")
|
||||
@Operation(summary = "Get current user details")
|
||||
@ApiResponse(responseCode = "200", description = "Current user details")
|
||||
@ApiResponse(responseCode = "401", description = "Not authenticated")
|
||||
public ResponseEntity<UserDetail> me(Authentication authentication) {
|
||||
if (authentication == null || authentication.getName() == null) {
|
||||
throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "Not authenticated");
|
||||
}
|
||||
UserDetail detail = rbacService.getUser(authentication.getName());
|
||||
if (detail == null) {
|
||||
throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "User not found");
|
||||
}
|
||||
return ResponseEntity.ok(detail);
|
||||
}
|
||||
|
||||
public record LoginRequest(String username, String password) {}
|
||||
public record RefreshRequest(String refreshToken) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user