From 54a2f10114dc26568b3fc5d44d0d7ac7a07335af Mon Sep 17 00:00:00 2001 From: Brendan Le Ny Date: Mon, 24 Jun 2024 15:00:09 +0200 Subject: [PATCH] Factorize URI creations --- .../sh/libre/scim/core/AbstractScimService.java | 16 ++++++++++------ .../sh/libre/scim/core/GroupScimService.java | 10 ++-------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/main/java/sh/libre/scim/core/AbstractScimService.java b/src/main/java/sh/libre/scim/core/AbstractScimService.java index 9586a23a3f..1d32e32355 100644 --- a/src/main/java/sh/libre/scim/core/AbstractScimService.java +++ b/src/main/java/sh/libre/scim/core/AbstractScimService.java @@ -207,15 +207,19 @@ public abstract class AbstractScimService { EntityOnRemoteScimId externalIdAsEntityOnRemoteScimId = groupMemberMapping.getExternalIdAsEntityOnRemoteScimId(); logger.debugf("found mapping for group member %s as %s", member, externalIdAsEntityOnRemoteScimId); groupMember.setValue(externalIdAsEntityOnRemoteScimId.asString()); - try { - String refString = String.format("Users/%s", externalIdAsEntityOnRemoteScimId.asString()); - URI ref = new URI(refString); - groupMember.setRef(ref.toString()); - } catch (URISyntaxException e) { - logger.warnf("bad ref uri for member " + member); - } + URI ref = getUri(ScimResourceType.USER, externalIdAsEntityOnRemoteScimId); + groupMember.setRef(ref.toString()); group.addMember(groupMember); } else { logger.warnf("member %s not found for group %s", member, groupModel.getId());