-
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
Fix Keycloak test server account setup that results in invalid grant with 25 #43571
Fix Keycloak test server account setup that results in invalid grant with 25 #43571
Conversation
I'll check the failures. I only tested module where I made changes. |
🎊 PR Preview 1ff7c69 has been successfully built and deployed to https://quarkus-pr-main-43571-preview.surge.sh/version/main/guides/
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
afd9f6d
to
8b92c52
Compare
@@ -107,7 +107,7 @@ | |||
<configuration> | |||
<skip>false</skip> | |||
<systemPropertyVariables> | |||
<keycloak.docker.image>${keycloak.docker.legacy.image}</keycloak.docker.image> | |||
<keycloak.version>${keycloak.version}</keycloak.version> |
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 think we can do it, we still have tests running against WildFly based distro
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.
why? isn't it much more desirable to test this module with Keycloak 25? anyway, I don't mind to drop it if you want. it's your area, just tell me where else can I test it.
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.
Yeah, if I recall it right it causes a legacy KC load, but with this change it would switch to the latest version. What do you need to test ?
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 changed this, because then this module uses Keycloak Test Server with 25 rather then legacy 19. It has only test NamedOidcClientFilterDevModeTest
and it reproduces the issue. I pasted error message in the description of this PR, it is the error thrown by this test when last name and first name are not set. Therefore it is a reproducer.
I don't know what is policy, but I tried to look in the Keycloak.org and it seems that they strongly recommended to use Quarkus-based version https://www.keycloak.org/2023/03/adapter-deprecation-update.html (this is for adapters because it's the newest article I found), so I thought it was not bad change.
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.
Dev service for KC does not set those properties but all works. I think you may instead do exactly what it and
some other tests do, load upconfig.json if it is non legacy
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.
Okay, I didn't realize that this KeycloakTestResourceLifecycleManager
is not supposed to work with Keycloak 25. I'll read docs properly next time. You recommend there Dev Svcs, https://quarkus.io/guides/security-oidc-bearer-token-authentication#bearer-token-integration-testing-keycloak, though honestly I didn't get that I must use legacy.
I'll use Dev Svc.
@sberyozkin I run smoke test with KC 24.0, 23.0 and it worked, but I cannot guarantee it will work with all the KC versions, I don't have in depth knowledge here. I have also mentioned that |
Status for workflow
|
@michalvavrik so what is the plan now? FYI, we already deal with this issue in similar cases, by loading upconfig, IMHO makes sense to do the same here, butvwe don't need to change tests |
I have no plan. Based on your comment and fact that https://quarkus.io/guides/security-oidc-bearer-token-authentication#bearer-token-integration-testing-keycloak says No, I don't want to specify my own json for trivial cases, so this PR worked and fixes the issue.
well, I thought I need to prove I am fixing the issue :-) considering this needs to be set via system properties, I am not sure I can reliably test it in just one added unit test, so unless I am allowed to change some test, I cannot test this. I can be wrong for sure... |
btw I used dev svc and it worked, thank you. |
@michalvavrik Sure, thanks, I'll do the minor update here at some point, hopefully most people are now using dev service Enjoy the weekend |
I was helping to my colleague to migrate from very old Keycloak 11 to 25 in the quarkus-qe/beefy-scenarios#510 and I mentioned that
io.quarkus:quarkus-test-keycloak-server
doesn't work anymore because a first name and last name are not set. Maybe changes are forced by https://www.keycloak.org/docs/25.0.6/upgrading/#default-validations that describes that we will be forced to update invalid values of the first name and the last name from previous versions. And here https://www.keycloak.org/docs/25.0.6/upgrading/#changes-to-the-user-representation-in-both-admin-api-and-account-contexts it is described that last name and the first name were moved to a different base class.The changes I made in the
quarkus-rest-client-oidc-filter-deployment
(legacy to 25) are reproducing the issue. Also it seems that setting these fields with the legacy image leads to failures.