From d3fc960914b6aae1f25c53befbfe6aa9444ce959 Mon Sep 17 00:00:00 2001 From: Chinthaka Dinadasa Date: Tue, 14 May 2024 21:57:25 +0530 Subject: [PATCH] user core service upgrade with auth service changes --- .../com/javatodev/finance/service/KeycloakUserService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internet-banking-user-service/src/main/java/com/javatodev/finance/service/KeycloakUserService.java b/internet-banking-user-service/src/main/java/com/javatodev/finance/service/KeycloakUserService.java index 109b091..15ed7fa 100644 --- a/internet-banking-user-service/src/main/java/com/javatodev/finance/service/KeycloakUserService.java +++ b/internet-banking-user-service/src/main/java/com/javatodev/finance/service/KeycloakUserService.java @@ -5,17 +5,22 @@ import org.keycloak.admin.client.resource.UserResource; import org.keycloak.representations.idm.UserRepresentation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import java.util.List; import jakarta.ws.rs.core.Response; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +@Slf4j @Service @RequiredArgsConstructor public class KeycloakUserService { + private static final Logger log = LoggerFactory.getLogger(KeycloakUserService.class); private final KeycloakManager keyCloakManager; public Integer createUser(UserRepresentation userRepresentation) { @@ -38,7 +43,7 @@ public UserRepresentation readUser(String authId) { UserResource userResource = keyCloakManager.getKeyCloakInstanceWithRealm().users().get(authId); return userResource.toRepresentation(); } catch (Exception e) { - System.out.println(e); + log.error("User not found under given ID {}", e.toString()); throw new EntityNotFoundException("User not found under given ID"); } }