-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Keycloak doesn't redirect to the proxy after authentication #26521
Comments
A possible solution that works for me is the following. Step 1: Pass forwarding headersIn
Step 2: Add a Forward filterIn WebConfigurer.java add a new bean:
The |
Interesting. I wasn't on the main branch. I'm on the release latest version. I haven't tried without tls. For me it makes sense to run in tls when using oath. I was also surprised that keycloak is not launched in tls. But I will give it a spin just to check. |
I also have issues on the @mshima FYI... it looks like we may have an issue with the |
What kind of problem?
Every CI samples uses prod profile except h2 tests. Maven profiles removes default profiles so: |
@mshima You answered and solved the problem while I was typing the message below.
@henri-tremblay I'm able to reproduce your issue and will try your fix. |
@henri-tremblay Your fix does not work. I believe this is because Spring Security sets the redirect and it's not based off the referrer or any header that's passed in. According to this Stack Overflow Q&A, it looks like you can implement an authentication success handler to make things work. |
We should drop custom BrowserSync config from wepback. |
@mshima Yes, sorry, I was launching from intellij the equivalent of |
@mraible What is happening on your side? For me the ForwardedHeaderFilter correctly picks up the X-*** to change the Host header (if I recall) that is then used to set the baseUrl for the redirect_uri (in DefaultOAuth2AuthorizationRequestResolver I think). |
@mraible Reading your stack overflow, I do not even try to go back to where I was. I do |
@henri-tremblay If you create a PR with your fix, I'd be happy to test it. |
I think you don't need to define explicit bean to use forwarded headers. Setting below property should work :
Since enabling use of forwarded headers is a security risk, I suggest adding it under |
You are right. Adding the property works as well. And yes, that's why my original forwarder was only in dev |
PR created. I'm guessing the same fix is needed for vue and react. I wasn't sure which file to modify. I need to regenerate for those. |
Overview of the issue
If you do
And I then authenticated, the redirect_uri sent to keycloak is https://localhost:8080/login/oauth2/code/oidc instead of port 9000, from browser-sync.
Motivation for or Use Case
If feel my flow is the normal development flow. UI should always be served by the proxy, so we would never use 8080 as the redirect_uri.
Suggest a Fix
The redirect_uri should be the one forwarded from the proxy but I am not sure how to do that yet.
JHipster Version(s)
I tried on 8.5.0 and earlier versions.
It's been like this for a while.
JHipster configuration
"authenticationType": "oauth2"
Browsers and Operating System
Chrome on Mac
The text was updated successfully, but these errors were encountered: