Skip to content

Commit

Permalink
user core service upgrade with auth service changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chinthaka-dinadasa committed May 14, 2024
1 parent a26123c commit d3fc960
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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");
}
}
Expand Down

0 comments on commit d3fc960

Please sign in to comment.