diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ClientRoleMappingsResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ClientRoleMappingsResource.java index 437e48636f40..5e4b24d2b58a 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/ClientRoleMappingsResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/ClientRoleMappingsResource.java @@ -183,7 +183,9 @@ public void addClientRoleMapping(List roles) { throw new ErrorResponseException("invalid_request", "Could not add user role or group mappings!", Response.Status.BAD_REQUEST); } - adminEvent.operation(OperationType.CREATE).resourcePath(uriInfo).representation(roles).success(); + if (!roles.isEmpty()) { + adminEvent.operation(OperationType.CREATE).resourcePath(uriInfo).representation(roles).success(); + } } diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RoleMapperResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RoleMapperResource.java index 1a82e7e6af8e..38caaa2e46ca 100644 --- a/services/src/main/java/org/keycloak/services/resources/admin/RoleMapperResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RoleMapperResource.java @@ -253,7 +253,9 @@ public void addRealmRoleMappings(@Parameter(description = "Roles to add") List