Refactor logging in LoginController, simplify auth.service token validation, and remove debug logs from AppealComponent.

This commit is contained in:
2025-08-05 23:22:12 +02:00
parent bdb38e5011
commit f67cb50f41
3 changed files with 18 additions and 18 deletions
@@ -93,6 +93,7 @@ public class LoginController implements LoginApi {
@Override
public ResponseEntity<UsernameDto> getUsername() {
log.debug("Loading username for logged in user");
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null || !(authentication.getPrincipal() instanceof OAuth2ResourceServerProperties.Jwt)) {
@@ -103,13 +104,14 @@ public class LoginController implements LoginApi {
UUID uuid;
try {
uuid = UUID.fromString(stringUuid);
log.debug("Loaded username for logged in user {}", uuid);
} catch (IllegalArgumentException e) {
return ResponseEntity.badRequest().build();
}
UsernameDto usernameDto = new UsernameDto();
usernameDto.setUsername(getUsername(uuid));
log.debug("Loaded username for logged in user {}", usernameDto.getUsername());
return ResponseEntity.ok(usernameDto);
}