Skip to content

Commit

Permalink
remove static constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
lvermeulen committed Jul 5, 2020
1 parent c95aa67 commit 25a663d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
11 changes: 1 addition & 10 deletions src/Keycloak.Net/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -47,7 +38,7 @@ public KeycloakClient(string url, Func<string> getToken)
{
_getToken = getToken;
}

private IFlurlRequest GetBaseUrl(string authenticationRealm) => new Url(_url)
.AppendPathSegment("/auth")
.ConfigureRequest(settings => settings.JsonSerializer = s_serializer)
Expand Down
3 changes: 1 addition & 2 deletions src/Keycloak.Net/RolesById/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Flurl.Http.Content;
using Keycloak.Net.Models.Common;
using Keycloak.Net.Models.Roles;
using Newtonsoft.Json;

namespace Keycloak.Net
{
Expand Down Expand Up @@ -52,7 +51,7 @@ public async Task<bool> 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;
}
Expand Down

0 comments on commit 25a663d

Please sign in to comment.