-
Notifications
You must be signed in to change notification settings - Fork 982
HTTPCLIENT-2358 Implement a mutual authentication capable SPNEGO scheme #615
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
base: master
Are you sure you want to change the base?
Conversation
|
@stoty I cannot contribute here much. My only wish, and I understand it is a big ask, to also create a compatibility test similar to those we have for BASIC / DIGEST with Squid and Apache HTTPD |
|
I was afraid you're going to say that... There are two ways to go about that:
I don't know which of the two is more work, but I know where to copy the test setup from for the second one. Do you have a preference ? |
@stoty Kek. Anyways, We already test for compatibility with Jetty in core by running it in a Docker container I t would be my preferred option but I do not know how difficult it is to pack extra Jetty dependencies into a Docker container. I was also hoping Apache HTTPD or Ngnix might have Kerberos support. If it is too much effort, disregard my request. |
|
It is a reasonable request, and it IS helpful to catch any regressions, etc. |
|
Apache Kerby implements Kerberos, you can get inspiration (copy) how they do it: https://directory.apache.org/kerby/ |
|
Kerby is great for in-JVM tests, but for dockerized tests it's probably easier to use MIT kerberos. |
|
After poking around a bit, it seems that neither Apache Httpd, not Nginx supports SPNEGO out of the box. For now, I plan to make a local test with Kerby + Jetty, without Docker. |
|
A full coverage test contains JGSS (via Tomcat my SpnegoAuthenticator), MIT Kerberos (via mod_auth_gssapi), Microsoft Kerberos (via IIS (SSPI)). Virtually impossible to automate. I will do manual testing anyway. I have everything in place at work 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.
This is much less code review. Thanks. I already see some points.
httpclient5/src/main/java/org/apache/hc/client5/http/auth/MutualKerberosConfig.java
Outdated
Show resolved
Hide resolved
httpclient5/src/main/java/org/apache/hc/client5/http/auth/MutualKerberosConfig.java
Outdated
Show resolved
Hide resolved
httpclient5/src/main/java/org/apache/hc/client5/http/auth/MutualKerberosConfig.java
Outdated
Show resolved
Hide resolved
|
Thanks. While I don't use Tomcat, testing Jgss with Jetty is doable, in fact one of the ways I tested this was via the SPNEGO test in HttpCLient->Calcite Avatica->Phoenix PQS. |
2d7dc5e to
5a11bce
Compare
|
I have added tests for direct connection to httpd + mod_auth_spnego, @michael-o . The async client cannot use the Subject set with Subject.callAs to figure out the Kerberos credentials (probably due to the auth being run from a different thread) Async still works if we create and set KerbersCredentials. (as in the new tests I added) |
|
I have added tests for SPNEGO authentication for Squid. I feel that this is ready now, @michael-o . |
Which bug exactly? |
httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/MutualGssSchemeBase.java
Show resolved
Hide resolved
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 am picking this up again and want to complete next month.
Structural issues:
- Since in both
authandimpl.pathpackages contains multiple new classes there should be in respective new subpackagesgssfor tidiness. - Don't use the term "Kerberos" in classnames becausee we perform SPNEGO with GSS-API, correctly it should be called "Gss"
- SPNEGO in class names should be written consistently, In PascalCase and not mixed case.
- Drop the prefix "Mutual" in class names altogether because one can disable on request making it a contradiction and the other party could pontentially deny it.
|
I can do that, but that would mean the the three formerly mutual classes only differ in case and package from the old deprecated classes. I can see that causing a lot of gried for users down the line.
Sure.
Sure.
Only the old deprecated classes use SPNego, and fixing those would make it even easier to mix them up with the new ones. (apart from breaking backwards compatibility, if we care about that)
I can do that, but then then the only difference between the old and new classes will be the packages and the case. |
|
Thanks for the review. I have also left KerberosCredentials alone, because it is used by both the new and old code. |
Don't rename old ones, only new ones. If old ones are reused maye it would be better to copy them? |
Yes, please. Don't break old deprecated, but add new classes for the new impl. |
|
Hi, @michael-o , I hope you had a good summer, Now that everyone is back at the grinder, I request you you to kindly help get this feature over the finish line. I have rebased the patch to the latest master (there were no major issues, some dependencies were removed and I had to add an exclusion to animal-sniffer for the reflection classes in SubjectUtil). I have also found two unresolved comments regarding code comments from you, I have resolved those. |
|
@michael-o Any chance this feature could make it into 5.6? |
Do you have a timeframe for 5.6? |
@michael-o I would like to release 5.6-alpha1 next week. However, a GA is unlikely sooner than Q2, so there is still some time, given this feature has no major API changes and can be added quite late in the release cycle. |
You mean 2026Q2? |
@michael-o Yes. |
|
I realized that the SpnegoUtil stuff is not really related to the new SPNEGO implementation, it is needed for JDK18+. Should I split that to a new ticket/PR ? |
|
@stoty You may still be stuck with @michael-o as a reviewer, but generally smaller change-sets are always easier to review and digest. |
|
My bad, SubjectUtil is only used in the test code I added, so it doesn't make a lot of sense to add it in a separate ticket. |
|
There is a separate (pre-existing) issue with JDK22+ and Async SPNEGO. I have opened https://issues.apache.org/jira/browse/HTTPCLIENT-2402 to track it, |
cdd7a4c to
068cd9a
Compare
|
I could factor out the ProtocolExec/AsyncProtocolExec and AuthenticationHandler changes into a separate JIRA, as those fix a bug in HTTPCLIENT-2356, and are not directly related to the new Scheme. Should I do that ? |
|
I have decided to create a separate JIRA for the proxy mutual auth issue mentioned above. Please take a look. |
Fix GSSCredential handling
…or non-compliant servers
Update some debug/exception messages
set isConnectionBased() to false fix logic in needsAuthentication()
068cd9a to
056483b
Compare
No description provided.