Refactor LoginController to use pattern matching for Jwt type check, simplify uuid extraction, and adjust debug logs.
This commit is contained in:
parent
56f4ccf40e
commit
d28b4a2b62
|
|
@ -96,11 +96,10 @@ public class LoginController implements LoginApi {
|
|||
log.debug("Loading username for logged in user");
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
log.debug("Loaded authentication for logged in user {}", authentication);
|
||||
if (authentication == null || !(authentication.getPrincipal() instanceof OAuth2ResourceServerProperties.Jwt)) {
|
||||
if (authentication == null || !(authentication.getPrincipal() instanceof Jwt jwt)) {
|
||||
log.debug("Loaded authentication for logged in user is null or not a jwt");
|
||||
return ResponseEntity.status(401).build();
|
||||
}
|
||||
Jwt jwt = (Jwt) authentication.getPrincipal();
|
||||
String stringUuid = jwt.getSubject();
|
||||
UUID uuid;
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user