lvermeulen / Keycloak.Net

C# client for Keycloak 6.x
MIT License
203 stars 120 forks source link

Convert Config of Mappings into Dictionaries #46

Open alexfdezsauco opened 3 years ago

alexfdezsauco commented 3 years ago

Why don't configs of mappings into dictionary?

I used this library recently for audience mapping and role mapping with Keycloak 11.0.0 and I must have to create classes that inherits from configurations and set the corresponding JsonProperty attribute value. For instance:

public class KeycloakClientConfig : ClientConfig
{
    [JsonProperty("multivalued")]
    public string MultiValued { get; set; }

    [JsonProperty("usermodel.clientRoleMapping.clientId")]
    public string UserModelClientRoleMappingClientId { get; set; }

    [JsonProperty("userinfo.token.claim")]
    public string CustomUserInfoTokenClaim { get; set; }

    [JsonProperty("claim.name")]
    public string CustomClaimName { get; set; }

    [JsonProperty("access.token.claim")]
    public string CustomAccessTokenClaim { get; set; }

    [JsonProperty("id.token.claim")]
    public string CustomIdTokenClaim { get; set; }

    [JsonProperty("jsonType.label")]
    public string JsonTypeLabel { get; set; }
}

If you turn this into a dictionary should be easy set such values.

kevintuke commented 3 years ago

Have same issue, like the idea of using a dictionary.

lvermeulen commented 3 years ago

I welcome a pull request for this.