Refactor logging in LoginController, simplify auth.service token validation, and remove debug logs from AppealComponent.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user