Skip to content
Snippets Groups Projects
Commit 8e97335d authored by Brendan Le Ny's avatar Brendan Le Ny Committed by Alex Morel
Browse files

Improve error messages and logs

parent cce36ab9
No related branches found
No related tags found
1 merge request!3Sonar refactoring
...@@ -97,7 +97,7 @@ public abstract class AbstractScimService<RMM extends RoleMapperModel, S extends ...@@ -97,7 +97,7 @@ public abstract class AbstractScimService<RMM extends RoleMapperModel, S extends
scimClient.delete(externalId); scimClient.delete(externalId);
getScimResourceDao().delete(resource); getScimResourceDao().delete(resource);
} catch (NoSuchElementException e) { } 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);
} }
} }
......
...@@ -60,7 +60,7 @@ public class ScimDispatcher { ...@@ -60,7 +60,7 @@ public class ScimDispatcher {
userScimServices.add(userScimService); userScimServices.add(userScimService);
} }
} catch (Exception e) { } 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 ? // TODO is it ok to log and try to create the other clients ?
} }
}); });
......
...@@ -107,7 +107,7 @@ public class ScimEventListenerProvider implements EventListenerProvider { ...@@ -107,7 +107,7 @@ public class ScimEventListenerProvider implements EventListenerProvider {
ScimResourceType type = switch (rawResourceType) { ScimResourceType type = switch (rawResourceType) {
case "users" -> ScimResourceType.USER; case "users" -> ScimResourceType.USER;
case "groups" -> ScimResourceType.GROUP; 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)); KeycloakId id = new KeycloakId(matcher.group(2));
handleRoleMappingEvent(event, type, id); handleRoleMappingEvent(event, type, id);
......
...@@ -78,7 +78,7 @@ public class ScimEndpointConfigurationStorageProviderFactory ...@@ -78,7 +78,7 @@ public class ScimEndpointConfigurationStorageProviderFactory
ScimDispatcher dispatcher = new ScimDispatcher(session); ScimDispatcher dispatcher = new ScimDispatcher(session);
for (GroupModel group : session.groups().getGroupsStream(realm) for (GroupModel group : session.groups().getGroupsStream(realm)
.filter(x -> BooleanUtils.TRUE.equals(x.getFirstAttribute("scim-dirty"))).toList()) { .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)); dispatcher.dispatchGroupModificationToAll(client -> client.replace(group));
group.removeAttribute("scim-dirty"); group.removeAttribute("scim-dirty");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment