-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Jetty 12.0.x Simplify tests with OpenId by using an exising openid provider and avoid extra not necessary maven modules #12274
Conversation
olamy
commented
Sep 16, 2024
- use keycloak as openid provider for testing
- remove extra modules not needed
- checkstyle
- start keycloak only once
- fix openid module for ee10
- fix typo
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 using keycloak is necessary to merge these modules, as we have an implementation of OpenIdProvider
with jetty-core. But I do think its an improvement, now we test with an actual OIDC provider implementation and not just a mockup.
...tests/jetty-ee9-test-openid-webapp/src/main/java/org/eclipse/jetty/test/openid/HomePage.java
Outdated
Show resolved
Hide resolved
tests/test-distribution/test-distribution-common/src/test/resources/keycloak/realm-export.json
Outdated
Show resolved
Hide resolved
The idea is to remove code we maintain and using proven existing solution. |
@lachlan-roberts init of keycloak done via some API usage. remove of this huge json import file. result of the cleanup |
...test-distribution-common/src/test/java/org/eclipse/jetty/tests/distribution/OpenIdTests.java
Outdated
Show resolved
Hide resolved
...test-distribution-common/src/test/java/org/eclipse/jetty/tests/distribution/OpenIdTests.java
Show resolved
Hide resolved
//"jetty.server.dumpAfterStart=true", | ||
}; | ||
|
||
try (JettyHomeTester.Run run2 = distribution.start(args2); WebClient webClient = new WebClient();) |
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 would have preferred use of the jetty HttpClient
instead of the gargoylesoftware one.
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.
bear in mind this is using now a real openid provider so there is a redirection to web page for login.
And not sure we really want to spend time parsing the returned HTML to find all the information such: cookie, all ids pass, session etc....
it;s not only an http client but most important a HTML parser and browser like library
it looks the easiest way to mimic a browser.
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.
The Jetty client will handle the session cookies, and can follow redirects, and here it is always reading the full content as a string and doing containsString(...)
checks on it, so no HTML parsing needed. And then there is a FORM submission which is also easy to do with the Jetty HttpClient.
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'm not 100% sure the rules adding new dependencies, but if you're sure we can add these for testing then LGTM.
Although I still prefer to use Jetty HttpClient for the testing if possible.
I don't understand the problem. It's just a test module not even deployed/distributed so adding dependency doesn't have any impact.
The problem is to extract data from the returned HTML. It's not like if parsing HTML was like parsing structured/well-formed data :) |
@lachlan-roberts using our own Jetty HttpClient done |
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
110b6b3
to
101e843
Compare