-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Customize application ObjectMapper can impact Keycloak admin client #30516
Comments
/cc @pedroigor (keycloak), @sberyozkin (keycloak) |
This is similar to the issue that was fixed here: #29984 . We need the Keycloak client ObjectMapper to be specific (and compatible with the requirements of the Keycloak client). |
@sdalichampt Is it RestEasy reactive or classic ? Can you please try the reactive option if it is classic ? #30146 might be related. |
Hey @gsmet Not sure the direct use of Object mapper is realistic as KeycloakAdminClient in Quarkus is just a JAX-RS Client so it can only pick up a provider as a JAX-RS provider AFAIK... Though @michalvavrik, do you recall I asked you to update it to pick up the Quarkus Jackson provider, were there some issues in native mode without it ? |
Keycloak Admin Client Reactive: Line 19 in 5c98cc7
Keycloak Admin Client Classic: I guess the classic version is affected, perhaps the reactive version can do better. |
#30436 might be related as well |
I'm pretty sure this is common problem for classic / reactive as we discussed it here #29076 (comment) (I'm still waiting for your answer there @sberyozkin :-) ). ATM we allow to customize KC client as it shares Quarkus Object Mapper, we can introduce a specific one. I wanted to do it, but waited till you might finish discussion with KC team as @gsmet suggested once you find a time. Please let me know.. |
Also I forgot. |
@sberyozkin i use RestEasy reactive |
I don't think it's affected as the object mapper is picked up from CDI. |
@michalvavrik Sorry, not sure what you'd like us to discuss with the KC team - it feels to me it would be us going in the wrong direction. |
By the way, if we can just register a Keycloak Admin Client Object mapper which works for KC Admin client as Guillaume recommends, then it would be nice, I'm just not sure it is possible - since a single instance of Jackson is shared between the client and the server if I understand it correctly, or a single instance of ObjectMapper is shared between multiple Jackson instances. And there were native image problems with KC specific Jackson support... |
RESTEasy Classic comment - Admin client by default uses RESTEasy Reactive comment - nothing to discuss with KC team.
Reactive comments:
Reactive comment: +1; we don't need this option from Quarkus as we register providers manually when we are creating the client. It's just down to decision whether to reuse ObjectMapper - @geoand opinion who wrote these parts is more important than mine.
I think here you are talking about classic KC admin client, right (because reactive already gives us easy option to set the mapper)? We can either set |
Hi Michal @michalvavrik, thanks for the analysis/feedback, so as far as this specific issue is concerned, we have a case of the shared Line 59 in 5c98cc7
new ObjectMapper() (possibly configured the same way as the default shared mapper), right ?
|
That's exactly how I see it @sberyozkin . |
I think we can probably be a little more intelligent and only create a new I have an idea for how start. Maybe in the future we can make it even smarter. |
#30529 is what I have in mind as a first step |
Thanks @geoand |
@michalvavrik Hey Michal, so re the classic RestEasy, since it is Resteasy classic specific provider (shipped with the Resteasy classic source) which is used with Keycloak Admin Client Classic, it would not pick up a custom Object Mapper set up at the Quarkus level, right ? |
Few months later |
This issue affects Keycloak Admin Client + ResteasyReactive combination, so having it working for RestEasy classic, given that we recommend ResteasyReactive in general, is less urgent. If you'll find some time in the next few weeks to have a look then it would be appreciated, you have the queue of issues already AFAIK :-) |
Use custom ObjectMapper for Keycloak admin client if necessary
Describe the bug
For a front application that required a snake case naming strategy I've customize the application ObjectMapper by adding this ObjectMapperCustomizer.
the most important line is
The application also allows you to list the users managed in keycloak by using the quarkus-keycloak-admin-client-reactive for this.
But io.quarkus.keycloak.admin.client.reactive.runtime.ResteasyReactiveClientProvider#getObjectMapper have the comment :
// the whole idea here is to reuse the ObjectMapper instance
So keycloak admin client resuse a customized ObjectMapper which is not compatible with keycloak naming strategy.
Expected behavior
Keycloak users must be returned with all of their properties valued: Id, Username, FirstName, LastName, ....
Actual behavior
Keycloak users are all returned, but some properties are not set. These, for example FistName or LastName remain empty.
These are the properties whose name is impacted by the overloaded snake case strategy in ObjectMapperCustomizer.
How to Reproduce?
No response
Output of
uname -a
orver
Ubuntu 22.10
Output of
java -version
openjdk version "19.0.1" 2022-10-18
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.15.3.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.6
Additional information
No response
The text was updated successfully, but these errors were encountered: