diff --git a/src/Keycloak.Net/KeycloakClient.cs b/src/Keycloak.Net/KeycloakClient.cs index ac26b598..fc9a7e99 100644 --- a/src/Keycloak.Net/KeycloakClient.cs +++ b/src/Keycloak.Net/KeycloakClient.cs @@ -16,15 +16,6 @@ public partial class KeycloakClient NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore }); - static KeycloakClient() - { - JsonConvert.DefaultSettings = () => new JsonSerializerSettings - { - ContractResolver = new CamelCasePropertyNamesContractResolver(), - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore - }; - } - private readonly Url _url; private readonly string _userName; private readonly string _password; @@ -47,7 +38,7 @@ public KeycloakClient(string url, Func getToken) { _getToken = getToken; } - + private IFlurlRequest GetBaseUrl(string authenticationRealm) => new Url(_url) .AppendPathSegment("/auth") .ConfigureRequest(settings => settings.JsonSerializer = s_serializer) diff --git a/src/Keycloak.Net/RolesById/KeycloakClient.cs b/src/Keycloak.Net/RolesById/KeycloakClient.cs index 88a8510c..a773d7f3 100644 --- a/src/Keycloak.Net/RolesById/KeycloakClient.cs +++ b/src/Keycloak.Net/RolesById/KeycloakClient.cs @@ -5,7 +5,6 @@ using Flurl.Http.Content; using Keycloak.Net.Models.Common; using Keycloak.Net.Models.Roles; -using Newtonsoft.Json; namespace Keycloak.Net { @@ -52,7 +51,7 @@ public async Task RemoveRolesFromCompositeAsync(string realm, string roleI { var response = await GetBaseUrl(realm) .AppendPathSegment($"/admin/realms/{realm}/roles-by-id/{roleId}/composites") - .SendJsonAsync(HttpMethod.Delete, new CapturedJsonContent(JsonConvert.SerializeObject(roles))) + .SendJsonAsync(HttpMethod.Delete, new CapturedJsonContent(s_serializer.Serialize(roles))) .ConfigureAwait(false); return response.IsSuccessStatusCode; }