-
Notifications
You must be signed in to change notification settings - Fork 332
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
Update lua-resty-openidc to 1.7.1-1 and add redirect_uri #114
base: master
Are you sure you want to change the base?
Conversation
LuanP
commented
Mar 25, 2019
- Update lua-resty-openidc to 1.7.1-1
- Add redirect_uri field to schema and sending it to lua-resty-openidc
@LuanP Can you provide an example of how this would be configured? Specifically, I'm trying to get this to work with a single redirect endpoint (e.g. https://auth.example.com/callback) for all of my upstreams (e.g. https://app1.example.com, https://app2.example.com). So far I've been unable to get it to work apart from all redirects going to the redirect endpoint, nothing makes the next jump to the upstream. My assumption is that the redirect endpoint cannot just be a "vanity URL" but needs some smarts such that it can parse the redirect and extract the ultimate endpoint from a request param. Can you confirm? |
@jerfer In our application we just created a /callback in one of the routes with the kong-oidc enabled. Also make sure it's the same redirect_uri provided by the OP. But I didn't have to implement anything on that route. |
@LuanP In order for the request_uri parameter to be recognized by lua-resty-openidc, I had to make a change to the code in your PR in the utils.lua/M.get_options() function:
But even with this change the redirection still doesn't work properly. Here's what's happening:
The problem is that I am not then again redirected to http://some_service.example.com/some/path, which I assumed would be the case. Is my assumption wrong that this is a supported configuration? What I'm trying to do is avoid having to list all my endpoint paths in my IdP configuration since it doesn't support wildcards on the path portion of redirect URLs, only on the domain-name portion (Auth0). This limitation effectively breaks deep-links unless I can work around it with Kong being able to manage the final redirect from http://auth.example.com/cb to http://some_service.example.com/some/path with the correct cookies set for the authentication. |
@jerfer You shouldn't have to list all your endpoint paths in the provider. Just having a match between the OP-RP is enough. Regarding the steps you've mentioned, your assumption is correct. When you try accessing a protected route on your application (through kong and having kong-oidc enabled on that route/service) you'd be redirected to the configured OP, get the authentication, and redirected to the request you were performing before, not the one in the redirect_uri/redirect_uri_path. It just looks like to be a misconfiguration somewhere. |
@LuanP Thanks for the confirmation and for taking the time to respond. I really appreciate the help. No, I'm not getting any errors anywhere so I'll tear everything down and start fresh to make sure I haven't missed anything or made a mistake somewhere. Did you see my comment about your PR and the M.get_options() function? Can you provide your (sanitized) OIDC plugin config as well as the ingress config for one of your routes? Being able to compare my configs to yours would help to identify what I'm doing wrong. Here's my OIDC plugin configuration, note the redirect_uri:
Here's the config I'm using for testing:
|
@LuanP I figured out the problem. Instead of using the redirect_uri parameter, I can rely instead on a wildcard subdomain as my Auth0 redirect with a hardcoded redirect_uri_path (e.g. http://*.example.com/auth/openid/callback). Kong is then able to successfully redirect from any subdomain/callback to the original request (e.g. http://app1.example.com/auth/openid/callback -> http://app1.example.com/some/path). The clue to all of this was is in #35. For completeness, here's my working config:
On the Auth0 side I configured the Allowed Callback URLs to contain: http://*.example.com/auth/openid/callback, meaning I don't have to add all services and their endpoints to Auth0. The final flow looks like this (simplified):
Thanks again for your help. |
Oh, good work on that man, sorry not being more helpful. About the comment on the changes, thanks for that, I'll update it here ASAP. |
No worries! You helped more than you think.
Jerry
…On Tue, May 21, 2019 at 8:52 PM Luan Pablo ***@***.***> wrote:
Oh, good work on that man, sorry not being more helpful.
About the comment on the changes, thanks for that, I'll update it here
ASAP.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#114?email_source=notifications&email_token=AALMWR3OEEVZO5DJHQ7HZDTPWSKOPA5CNFSM4HA2WN5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV5SVGY#issuecomment-494611099>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALMWR6NI2MECWTFN7YRLJ3PWSKOPANCNFSM4HA2WN5A>
.
|