From 2de53efcab4b4c7e2bd407c5a01213aef5f90ed5 Mon Sep 17 00:00:00 2001 From: Hiroyuki Wada Date: Mon, 29 Aug 2022 17:45:24 +0900 Subject: [PATCH] fix: can't update client role's name correctly --- .../keycloak/rest/KeycloakAdminRESTClientRole.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/jp/openstandia/connector/keycloak/rest/KeycloakAdminRESTClientRole.java b/src/main/java/jp/openstandia/connector/keycloak/rest/KeycloakAdminRESTClientRole.java index 945a69d..3c00f73 100644 --- a/src/main/java/jp/openstandia/connector/keycloak/rest/KeycloakAdminRESTClientRole.java +++ b/src/main/java/jp/openstandia/connector/keycloak/rest/KeycloakAdminRESTClientRole.java @@ -156,7 +156,16 @@ public void updateClientRole(KeycloakSchema schema, String realmName, Uid uid, S try { for (AttributeDelta delta : modifications) { if (delta.getName().equals(Name.NAME)) { - current.setName(AttributeDeltaUtil.getAsStringValue(delta)); + String name = AttributeDeltaUtil.getAsStringValue(delta); + String[] split = name.split("/"); + + if (split.length != 2) { + throw new InvalidAttributeValueException("Invalid clientRole name format." + + " It must be /. name: " + name); + } + + current.setContainerId(split[0]); + current.setName(split[1]); } else if (delta.getName().equals(ATTR_DESCRIPTION)) { current.setDescription(AttributeDeltaUtil.getStringValue(delta));