Replies: 3 comments
-
/cc @pedroigor (oidc), @sberyozkin (oidc) |
Beta Was this translation helpful? Give feedback.
-
@navkast, Hello,
Quarkus OIDC does not, on its own, do redirects between different application endpoints (hosted on different domains or localhost ports), its job is to secure a single endpoint only. The restore request path property supports this flow: a call goes to Your custom route may help to support redirecting between different endpoints but since the OIDC code flow completes in one domain, I'm not 100% sure how to handle it. Perhaps the cookie domain property can be widened to cover both domains ? If that does not help, then please create a reproducer for the local host case, and I can look into it further. Once it all works, we can look at what Quarkus OIDC can help with further, but right now more analysis in needed. |
Beta Was this translation helpful? Give feedback.
-
You may also want to have a look at https://github.com/quarkiverse/quarkus-oidc-proxy, though I'm not sure it can fit your use case. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
I'm using OIDC authorization code flow. I'm struggling to come up with a good solution. I'm on Quarkus 3.18.3.
mywebsite.url
. The backend is inapi.mywebsite.url
. This means the frontend is making CORS requests toapi.mywebsite.url
Problem
The problem is the OIDC layer isn't working properly. I'm using OIDC powered by AWS cognito, and the cookies aren't being set properly in the way I'd expect them to be.
Here's what I'm trying, based on the available documentation:
quarkus.oidc.authentication.redirect-path = /auth/callback
quarkus.oidc.authentication.restore-path-after-redirect = false
quarkus.oidc.authentication.redirect-path = /auth/callback quarkus.oidc.authentication.restore-path-after-redirect = false
quarkus.oidc.authentication.redirect-path = /auth/callback quarkus.oidc.authentication.restore-path-after-redirect = true
Ideally, I want Quarkus to do the OIDC token exchange flow for authorization code on a virtual endpoint, and then redirect the page (and set cookies), to the home page. Anyonw know what the best solution here is?
My application.properties:
Some experimentation:
Localhost
In localhost, I am able to edit these lines:
to:
AND add a route:
This works, but only in localhost, where
mywebsite.url
islocalhost:5173
. Why is creating an endpoint necessary? I thought a virtual endpoint would work.Real environment
In a real environment, the frontend is being served by Cloudfront CDN, in
mywebsite.url
. The backend is inapi.mywebsite.url
. This means the frontend is making CORS requests toapi.mywebsite.url
. This is why I set the cookie domain toquarkus.oidc.authentication.cookie-domain=.${mywebsite.url}
. However, that doesn't work - the state cookie doesn't register and I go on an infinte redirect. This seems to be a different problem.Beta Was this translation helpful? Give feedback.
All reactions