Improve error messages and logs

This commit is contained in:
Brendan Le Ny 2024-06-24 09:56:16 +02:00 committed by Alex Morel
parent cce36ab990
commit 8e97335de4
4 changed files with 4 additions and 4 deletions

View file

@ -97,7 +97,7 @@ public abstract class AbstractScimService<RMM extends RoleMapperModel, S extends
scimClient.delete(externalId);
getScimResourceDao().delete(resource);
} catch (NoSuchElementException e) {
throw new ScimPropagationException("Failed to delete resource %s, scim mapping not found : " + id, e);
throw new ScimPropagationException("Failed to delete resource %s, scim mapping not found: ".formatted(id), e);
}
}

View file

@ -60,7 +60,7 @@ public class ScimDispatcher {
userScimServices.add(userScimService);
}
} catch (Exception e) {
logger.warnf("[SCIM] Invalid Endpoint configuration %s : %s", scimEndpointConfigurationRaw.getId(), e.getMessage());
logger.warnf("[SCIM] Invalid Endpoint configuration %s: %s", scimEndpointConfigurationRaw.getId(), e.getMessage());
// TODO is it ok to log and try to create the other clients ?
}
});

View file

@ -107,7 +107,7 @@ public class ScimEventListenerProvider implements EventListenerProvider {
ScimResourceType type = switch (rawResourceType) {
case "users" -> ScimResourceType.USER;
case "groups" -> ScimResourceType.GROUP;
default -> throw new IllegalArgumentException("Unsuported resource type : " + rawResourceType);
default -> throw new IllegalArgumentException("Unsuported resource type: " + rawResourceType);
};
KeycloakId id = new KeycloakId(matcher.group(2));
handleRoleMappingEvent(event, type, id);

View file

@ -78,7 +78,7 @@ public class ScimEndpointConfigurationStorageProviderFactory
ScimDispatcher dispatcher = new ScimDispatcher(session);
for (GroupModel group : session.groups().getGroupsStream(realm)
.filter(x -> BooleanUtils.TRUE.equals(x.getFirstAttribute("scim-dirty"))).toList()) {
logger.infof("[SCIM] Dirty group : %s", group.getName());
logger.infof("[SCIM] Dirty group: %s", group.getName());
dispatcher.dispatchGroupModificationToAll(client -> client.replace(group));
group.removeAttribute("scim-dirty");
}