-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
BE: Respect proxy settings for OAuth requests #4114
Comments
Hello there poom-kitti! 👋 Thank you and congratulations 🎉 for opening your very first issue in this project! 💖 In case you want to claim this issue, please comment down below! We will try to get back to you as soon as we can. 👀 |
I did get the proxy to work by implementing The manager seems to interact with Okta for 3 things and the following classes are used for those interactions:
My SolutionI get the proxy system properties to work by making following changes in
This is the code for
Please check my commit which should make this clearer: poom-kitti@3b88135 ResultAfter applying the changes and rebuild Kafka UI along with deploying (using same Java system properties related to proxy), the authentication now works. I can confirm that proxy is used because from debug logs, instead of making connection to Okta directly, it is connecting to proxy instead.
CaveatsThe drawback of my current implementations are:
Since I lack experience with Spring, I do not wish to claim this issue, but hope my investigation help in some way. |
@poom-kitti Hi and thank you very much for the analysis, saved me some time in research. Even if we implement the changes in other places, we won't be able to decode JWT token without these changes. Related: spring-projects/spring-security#8882
and probably some others which we need to determine on a per-use-case basis. I suggest we put this on hold for some time to see if spring-projects/spring-security#13274 does get any traction to see if we can avoid copy-pasting the whole factory bean. |
Hi, Is there a workaround not involving editing the java code for this? Or do we have to wait for it to be solved? It seems the issue spring-projects/spring-security#13274 is now closed. What are the next steps? |
Some news about this fix ? |
Some news about this fix ? |
@seb2020 see the comment above yours |
Issue submitter TODO list
master
-labeled docker image and the issue still persists thereDescribe the bug (actual behavior)
To give some context, our Kafka UI is deployed in a server inside a virtual private network. This mean:
When Kafka UI is deployed in the server, it does not respect using proxy declared in any of the following Java system properties when performing connection to Okta to perform authentication:
Once a client tried to connect to Kafka UI, they are directed to authenticate to Okta correctly. However, after the client passed the code which they received from Okta back to Kafka UI triggering Kafka UI to perform POST request to Okta's token URI, it fails due to
java.net.NoRouteToHostException
indicating that the proxy is not in-use.From some exploration, I believe that Spring security is using the
DefaultWebClient
to perform authentication and this WebClient does not respect the system properties on using proxy.Expected behavior
When specified the system property like
-Dhttps.proxyHost=my.proxy.host -Dhttps.proxyPort=3218 -Dhttps.nonProxyHosts=XXXX.local|10.*
, the authentication should be using proxy to make connection to Okta.Your installation details
App version: 0.7.1 (as of commit
b32ab0143679bd3224f097a9de0eefad4e60f8d6
)Application YAML:
I deliberately did not add any configuration regarding connection to Kafka as it is unnecessary to show behavior of Okta authentication. In addition, this way, it make showing debug log clearer as we will only get debug log regarding authentication.
Steps to reproduce
Screenshots
From the network tab in developer tool, we can see that Okta returns some code to user and this is passed to Kafka UI; however the get request to
<kafka ui endpoint>/login/oauth2/code/okta?code=<some code>
failed.Logs
From logs, I see the following error:
When setting the environment variable
LOGGING_LEVEL_ROOT=debug
to show debug log, I see the following logs that signify that Kafka UI is trying to connect to the Okta endpoint directly. This should not be the case because it should use proxy instead.Additional context
No response
The text was updated successfully, but these errors were encountered: