Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol Mapper Issue #60

Open
ghost opened this issue Aug 3, 2021 · 2 comments
Open

Protocol Mapper Issue #60

ghost opened this issue Aug 3, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 3, 2021

When working with the protocol mappers I encounter a severe bug in the JSON implementation.
This class Keycloak.Net.Models.ProtocolMappers.Config should be changed to Dictionary<string,object>
Per the docs https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_protocolmapperrepresentation this attribute it's type map meaning that there's not defined structure so a named based structure like the one you have is not working and will not retrieve all the information.
please change it to Dictionary class:
see also
https://docs.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonextensiondataattribute?view=net-5.0
https://stackoverflow.com/questions/14893614/how-to-serialize-a-dictionary-as-part-of-its-parent-object-using-json-net

@ghost
Copy link
Author

ghost commented Aug 3, 2021

Suggested change:

Keycloak.Net.Models.ProtocolMappers.ProtocolMapper
[JsonProperty("config")]
public Config Config { get; set; }

should be replaced to:
[JsonProperty("config"), JsonExtensionData]
public Dictionary<string, object> Config { get; set; }

@AnderssonPeter
Copy link

I have created a new nuget package that has this fix https://www.nuget.org/packages/Keycloak.Net.Core/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant