Fix /Users URI for group membership changes

This commit is contained in:
Alex Morel 2024-06-21 17:13:04 +02:00
parent 0cac71c4a1
commit cce36ab990
3 changed files with 5 additions and 4 deletions

View file

@ -99,13 +99,14 @@ public class GroupScimService extends AbstractScimService<GroupModel, Group> {
logger.debug(userMapping.getExternalIdAsEntityOnRemoteScimId());
logger.debug(userMapping.getIdAsKeycloakId());
groupMember.setValue(userMapping.getExternalIdAsEntityOnRemoteScimId().asString());
URI ref = new URI(String.format("Users/%s", userMapping.getExternalIdAsEntityOnRemoteScimId()));
String refString = String.format("Users/%s", userMapping.getExternalIdAsEntityOnRemoteScimId().asString());
URI ref = new URI(refString);
groupMember.setRef(ref.toString());
group.addMember(groupMember);
} catch (NoSuchElementException e) {
logger.warnf("member %s not found for group %s", member, groupModel.getId());
} catch (URISyntaxException e) {
logger.warnf("bad ref uri");
logger.warnf("bad ref uri for member " + member);
}
}
return group;

View file

@ -83,6 +83,7 @@ public class ScimClient<S extends ResourceNode> implements AutoCloseable {
private void checkResponseIsSuccess(ServerResponse<S> response) {
if (!response.isSuccess()) {
LOGGER.warn("[SCIM] Issue on SCIM Server response ");
LOGGER.warn(response.getResponseBody());
LOGGER.warn(response.getHttpStatus());
}
@ -98,7 +99,6 @@ public class ScimClient<S extends ResourceNode> implements AutoCloseable {
public void replace(EntityOnRemoteScimId externalId, S scimForReplace) {
Retry retry = retryRegistry.retry("replace-%s".formatted(externalId.asString()));
LOGGER.warn(scimForReplace);
ServerResponse<S> response = retry.executeSupplier(() -> scimRequestBuilder
.update(getResourceClass(), getScimEndpoint(), externalId.asString())
.setResource(scimForReplace)

View file

@ -146,7 +146,7 @@ public class ScimDispatcher {
private void logAndRollback(ScrimProviderConfiguration scimServerConfiguration, ScimPropagationException e) {
logger.error("[SCIM] Error while propagating to SCIM endpoint " + scimServerConfiguration.getId(), e);
session.getTransactionManager().rollback();
// TODO session.getTransactionManager().rollback();
}
private void initializeClientsIfNeeded() {