From 35b425736a5b14a0fdf10bcbde9864d16dcc74a8 Mon Sep 17 00:00:00 2001 From: Jonas Suter Date: Mon, 4 Nov 2024 16:53:05 +0100 Subject: [PATCH] Strip Double Quotes from Request Content in Organization API Closes #34401 Signed-off-by: Jonas Suter --- .../admin/resource/OrganizationIdentityProvidersResource.java | 2 ++ .../organization/admin/resource/OrganizationMemberResource.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/services/src/main/java/org/keycloak/organization/admin/resource/OrganizationIdentityProvidersResource.java b/services/src/main/java/org/keycloak/organization/admin/resource/OrganizationIdentityProvidersResource.java index 0395d4d7bf..4634f30c02 100644 --- a/services/src/main/java/org/keycloak/organization/admin/resource/OrganizationIdentityProvidersResource.java +++ b/services/src/main/java/org/keycloak/organization/admin/resource/OrganizationIdentityProvidersResource.java @@ -70,6 +70,8 @@ public class OrganizationIdentityProvidersResource { description = "Adds, or associates, an existing identity provider with the organization. If no identity provider is found, " + "or if it is already associated with the organization, an error response is returned") public Response addIdentityProvider(String id) { + id = id.replaceAll("^\"|\"$", ""); // fixes https://github.com/keycloak/keycloak/issues/34401 + try { IdentityProviderModel identityProvider = session.identityProviders().getByIdOrAlias(id); diff --git a/services/src/main/java/org/keycloak/organization/admin/resource/OrganizationMemberResource.java b/services/src/main/java/org/keycloak/organization/admin/resource/OrganizationMemberResource.java index 478a78cc0c..525dd325c6 100644 --- a/services/src/main/java/org/keycloak/organization/admin/resource/OrganizationMemberResource.java +++ b/services/src/main/java/org/keycloak/organization/admin/resource/OrganizationMemberResource.java @@ -81,6 +81,8 @@ public class OrganizationMemberResource { "an existing user with the organization. If no user is found, or if it is already associated with the organization, " + "an error response is returned") public Response addMember(String id) { + id = id.replaceAll("^\"|\"$", ""); // fixes https://github.com/keycloak/keycloak/issues/34401 + UserModel user = session.users().getUserById(realm, id); if (user == null) {