-
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
Use keycloak-client libraries instead of keycloak-common, keycloak-core and keycloak-adapter-spi #43260
base: main
Are you sure you want to change the base?
Conversation
Thanks @pskopek for the PR, I think I understand the idea, but I'm not sure I appreciate the consequences if any for Quarkus, I'd like to ask @pedroigor and @mposolda to review, thanks |
@pskopek I can try the devservice myself a little bit later to save you some time |
This comment has been minimized.
This comment has been minimized.
🎊 PR Preview 00852eb has been successfully built and deployed to https://quarkus-pr-main-43260-preview.surge.sh/version/main/guides/
|
@pskopek afaics, only the dependency on |
This comment has been minimized.
This comment has been minimized.
The failures are unrelated. |
@pskopek Keycloak devservice is OK with this update :-), thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add the Keycloak dependencies that are direct dependencies of Quarkus extensions back to the BOM.
71f2bbc
to
8bd84fc
Compare
@sberyozkin @aloubyansky I fixed the issues with versions you requested. There is a separation between Keycloak Server (25.0.6) for testing purpose and Keycloak Client Libs (26.0.0) used in Quarkus. |
Dependency-wise this looks better @pskopek, thanks! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8bd84fc
to
948263f
Compare
0f25936
to
3ed1996
Compare
1fa8ab9
to
9b3fb7f
Compare
@pskopek I've pushed the latest Quarkus updates to check if the OIDC test failure is repeatable, thanks |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bfe72df
to
dd260da
Compare
@pskopek Hi, the fact that so many dependencies are coming in with the new keycloak client now and we have to exclude them for example in the OIDC deployment, makes me a little bit nervous, any code now which only needs to work, for example, with |
If every quarkus user have to exclude those dependencies that is definitely problematic since afaik we cannot even do this in the platform bom. We need a dependency that does not drag in unnecessary classes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 until this is show to work without users having to exclude dependencies manually.
This comment has been minimized.
This comment has been minimized.
Hmmm. Wait a bit: it has always been the case that we needed to exclude dependencies: the Keycloak Admin Client comes with a default REST Client implementation (or it wouldn't work out of the box). In Quarkus, we have 2 extensions for the admin client that comes with either the RESTEasy client or the Quarkus REST client. In practice, it's not a problem for our users: we are doing the work for them and this PR doesn't change a thing. Happy to be corrected if I'm wrong. |
I watched this discussion progress and I think you are right, but there is one point in discussion I am missing. There are exclusions in Keycloak Dev Services for RESTEasy that is not needed. The
I think is mixing points. @pskopek is bringing Keycloak Admin Client instead of Keycloak Core and they don't want to put these DTOs into separate dependency because it would require additional work and that is why exclusions are needed. Do I get situation correctly @pskopek ? |
This comment has been minimized.
This comment has been minimized.
@pskopek I think the native failure is related |
This is likely to be precise... Peter, @pskopek, what do you think, would it be a problem to release I'm pretty sure that Keycloak devservice is not the only piece of code which uses keycloak core classes like @pskopek Think about it please, check with the team, hopefully it won't be a problem to have Let's try to finalize it as we need to to move to Keycloak 26.x |
dd260da
to
2d2e357
Compare
// Same like JSONSerialization class. Makes it possible to use admin-client against older versions of Keycloak server where the properties on representations might be different | ||
newObjectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
// The client must work with the newer versions of Keycloak server, which might contain the JSON fields not yet known by the client. So unknown fields will be ignored. | ||
newObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is interesting because it will only impact scenario when user customized objected mapper (or provided his own instance). I kinda expect that most users won't be impacted by this change. @geoand please review this file. Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes makes Admin client to not fail when working with older KC versions. I trust that @pskopek determined that KC admin client is always backwards compatible and it is fine that KC Admin client will be used with older versions.
But - these changes will only affect scenarios when user customized ObjectMapper bean or provided his own bean:
- https://quarkus.io/guides/all-config#quarkus-jackson_quarkus-jackson-fail-on-unknown-properties is set to
false
by default - https://quarkus.io/guides/all-config#quarkus-jackson_quarkus-jackson-serialization-inclusion is not set by default
And what I say:
- either I read situation wrong
- or this needs to be done for all the scenarios, because I expect that affected scenario here is only minor, most users don't need to customize default ObjectMapper?
Please @geoand or @pskopek check again or prove me wrong. Maybe I misread situation. Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is interesting because it will only impact scenario when user customized objected mapper (or provided his own instance). I kinda expect that most users won't be impacted by this change. @geoand please review this file. Thank you
Agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what Keycloak's requirements are, but from the looks of this PR, it seems Keycloak needs a completely separate ObjecMapper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for having a look @geoand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing it to my attention!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pskopek Can you please comment here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Keycloak Admin needs differently configured ObjectMapper
. I modified the PR, but I am not the Quarkus expert. @geoand , can you review the change, please?
@sberyozkin I have updated keycloak-client to 26.0.2 and fixed all issues in tests. @michalvavrik missing |
Thanks Peter, @pskopek, looks much better now. I have a couple of questions:
PR is getting much closer to the completion though, thanks |
@pskopek Oh sorry, ignore please the So then the only question is, can the common release artifact be named as |
We decided to name it with |
@pskopek OK, thanks for the explanation, I guess we can work with this artifact name as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had another look.
I think we really need to inspect the dependencies of the adjusted modules as I think I have seen the Apache HTTP Client crawling back in the dependencies and I'm not sure that's what we want.
<artifactId>jakarta.activation</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
<artifactId>keycloak-client-common-synced</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now brings the Apache HTTP client as a dependency.
We used to have:
[INFO] +- org.keycloak:keycloak-core:jar:25.0.6:compile
[INFO] | +- org.keycloak:keycloak-common:jar:25.0.6:compile
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:2.1.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.18.1:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.18.1:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.18.1:compile
[INFO] | \- org.eclipse.microprofile.openapi:microprofile-openapi-api:jar:4.0.2:compile
we now have:
[INFO] +- org.keycloak:keycloak-client-common-synced:jar:26.0.2:compile
[INFO] | +- org.jboss.logging:commons-logging-jboss-logging:jar:1.0.0.Final:runtime
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
[INFO] | | \- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.18.1:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.18.1:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-databind:jar:2.18.1:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.18.1:compile
[INFO] | +- org.eclipse.microprofile.openapi:microprofile-openapi-api:jar:4.0.2:compile
[INFO] | \- jakarta.activation:jakarta.activation-api:jar:2.1.3:compile
I'm not sure we want that?
Now I don't know if we actually want to use the Admin Client now (or later?) to initialize the container in some way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I don't know if we actually want to use the Admin Client now (or later?) to initialize the container in some way?
We don't use the Admin Client in KC Dev Svc. We use there Vert.x Web Client. We only need DTOs from org.keycloak.representations
.
Not sure if it is relevant, but KC Dev Svc is now KC Admin Client dependency, I don't know if above-mentioned tree was done when rebased on current main. It only happened lately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not relevant for the tree of one dependency, but it is relevant for context - if you do exclusions.
<artifactId>jakarta.activation</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here actually. We now have a dependency with the Apache HTTP Client and I don't think we want (except if I'm mistaken) that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gsmet This is a mistake at keycloak-client-common-synced
side. I will fix it there and update this PR with new version of keycloak-client
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I will have another look next week.
…re and keycloak-adapter-spi Closes quarkusio#43259 Signed-off-by: Peter Skopek <[email protected]>
2d2e357
to
fbf5c2a
Compare
Status for workflow
|
Status for workflow
|
Status | Name | Step | Failures | Logs | Raw logs | Build scan |
---|---|---|---|---|---|---|
✖ | JVM Tests - JDK 17 | Build |
Failures | Logs | Raw logs | 🔍 |
✖ | JVM Tests - JDK 21 | Build |
Failures | Logs | Raw logs | 🔍 |
Full information is available in the Build summary check run.
You can consult the Develocity build scans.
Failures
⚙️ JVM Tests - JDK 17 #
- Failing: extensions/keycloak-admin-resteasy-client/deployment
! Skipped: extensions/keycloak-authorization/deployment integration-tests/keycloak-authorization
📦 extensions/keycloak-admin-resteasy-client/deployment
✖ io.quarkus.keycloak.adminclient.deployment.KeycloakAdminClientMutualTlsDevServicesTest.testCreateRealm
line 50
- History - More details - Source on GitHub
java.lang.AssertionError:
1 expectation failed.
Expected status code <204> but was <400>.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
⚙️ JVM Tests - JDK 21 #
- Failing: extensions/keycloak-admin-resteasy-client/deployment
! Skipped: extensions/keycloak-authorization/deployment integration-tests/keycloak-authorization
📦 extensions/keycloak-admin-resteasy-client/deployment
✖ io.quarkus.keycloak.adminclient.deployment.KeycloakAdminClientMutualTlsDevServicesTest.testCreateRealm
line 50
- History - More details - Source on GitHub
java.lang.AssertionError:
1 expectation failed.
Expected status code <204> but was <400>.
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:73)
This PR uses keycloak-client 26.0.0-alpha2. If it passes all checks and reviews I can release final and update the PR.
Closes #43259