-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
OIDC redirect-path property #17563
Comments
/cc @pedroigor, @sberyozkin |
Hi @fouad-j Can you explain please why do you need to use an absolute redirect path ? If a user needs to access a given Quarkus endpoint then why would the user be redirected, after the authentication, to the endpoint in some other domain ? |
Hi @sberyozkin , thank you for your answer, I work with @fouad-j, Our case is that after login to the provider (let's say : tenant-a) quarkus redirect (the app to the redirect-path) as we configured in application.properties with : quarkus.oidc.tenantName.authentication.redirect-path=/token. (let's say /token endpoint as redirect path) Problem is, in our case, quarkus redirect to our: KUBERNETES_INGRESS_HOST/token, which is not our "backend" Url domain, but the DNS of our front end part. So we wanted to just change the "KUBERNETES_INGRESS_HOST" part to our Backend URL (let's say : https://project.com) and the redirect path registered in the tenant-a provider is : https://project.com/token. So we wanted just to change the redirect-path property : That is why we want to have the choice of an absolute path for the redirect-path , we would like that the configuration give : So the problem is not that we want to redirect in some other domain but more because quarkus redirect to the bad redirect path, (in our case at least: redirect context is KUBERNETES_INGRESS_HOST instead of https://project.com which is our url for our backend services) |
@AJ1032480 Hi, thanks, I believe we've had similar problems reported before. Can that help ? |
It is interresting to see that keykloak have a KEYCLOAK_FRONTEND_URL mode, |
Hello @sberyozkin, Thanks for your reactivity. I drew a diagram to explain the flow
http://auth-svc.cluster.local is accessible only in the cluster. |
@fouad-j thanks, have you tried your patch in your deployment ? What happens when, after the redirect, Quarkus attempts to exchange the authorization code for the tokens ? |
@AJ1032480 @fouad-j Here is another link for you: https://quarkus.io/guides/vertx#reverse-proxy Can you try:
Can you please check what X-Forwarded heades the I'm quite sure we've had such an issue before, can't find the Zulip thread. We'll make sure it works for you - but if possible I'd like to avoid tweaking the code to workaround various networking setup issues |
Hello @sberyozkin, Thanks a lot for last message, it was very helpful. Based on X-Forwarded and X-Original headers, we did a bad workaround Workaroundapplication.properties
CustomResolver@ApplicationScoped
public class CustomTenantResolver implements TenantResolver {
@Context
HttpServerRequest request;
@Override
public String resolve(RoutingContext context) {
String originalHost = context.request().headers().get("X-ORIGINAL-HOST");
context.request().headers().set("X-Forwarded-Host", url);
context.request().headers().set("X-Forwarded-For", url);
....
}
} We override X-Forwarded headers by X-Original values because ForwardedParser.java doesn't manage X-Original headers. Here are headers we receive from ingress
It works because the URL we defined refers to the public DNS of our authentication service QuestionsFor workaround:
For Oidc extension
|
@AJ1039593 Thanks for making it work, it is a good enough workaround IMHO :-)
Please do - I think we need to make it very easy for cases where the server is running behind Kubernetes Ingress and i can imagine it would not only be needed for
The |
@AJ1039593 can you try adding:
That should really do it without any workaround |
I'll update the OIDC docs once it works - it should really be supported well at the Quarkus Vert.x level - for the users not having to be concerned about such details as the external URLs a given Quarkus endpoint can be accessed at (OIDC logout would be another redirect which would be affected, etc) |
Hello @sberyozkin, Sorry for delay, we managed to install OIDC MULTI-TENANCY in our microservices architecture and behind Kubenetes. We used two identity providers
Here is the configuration of Gigya (it may help someone)
The configuration to make OIDC works behind proxy/reverse proxy like ingress Solution 1 (easy)Merge my PR or extends OidcAuthenticationMechanism and CodeAuthenticationMechanismto apply the fix if PR is reject. then set you redirect_uri in application.properties
http://mydomain.com/tenantName refer to the public DNS of our authentication service in the cluster Solution 2 (hard)This solution is a little difficult because you need to know how (kubernetes, ingress, proxy/reverse proxy, headers...) work Here is the configuration that you may adjust to your case (more details)
@sberyozkin thanks a lot for your help, please let me know if it's not clear or if you need more details |
Hi @fouad-j thanks for the update, and glad to hear it works with configuring the forwarded header. The hardest part here is finding out the name of Setting |
@pedroigor What is your opinion ? The problem is well descried above: when the OIDC provider (it is not Keycloak, so no So one solution which already works is that the Quarkus forwarding filter is configured to recognize the external address (similar approach is already used for SSL terminating proxies, forwarded prefixes, etc) Hence I'm thinking of resolving this issue with a PR updating the docs with the info how to configure the forwarding filter in cases like this one. |
@AJ1039593 @AJ1032480 I've updated the docs in #17921 and it will close this issue, and I will close your PR. |
Description
We faced an issue with
quarkus.oidc.tenantName.authentication.redirect-path=http://mydomain.com/tenantName
Current behavior of
redirect-path
is to append value set in application properties to request URL from contextFor example for
quarkus.oidc.tenantName.authentication.redirect-path=http://mydomain.com/tenantName
The redirect url would be http://requestContextUrl.com/http://mydomain.com/tenantName
Implementation ideas
I have a proposal to fix this issue #17562
If the redirect-path start with http or https we take it as it is
The text was updated successfully, but these errors were encountered: