-
Notifications
You must be signed in to change notification settings - Fork 141
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
Fix post logout redirect, add config for default #40
Conversation
Otherwise the req.openid.tokens is undefined.
ping @joshcanhelp 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@balazsorban44 - Appreciate your patience here. This is really close, just a few small changes and we'll get this merged in. Also, would be great to get a few tests written to make sure that the URL is coming through in all the cases.
Covering returnTo and postLogoutRedirectUri cases for both application and idp logout.
Moved some parts around a bit in the tests, hopefully it is OK with you. Moved the Used this great article by Kent.C.Dodds: Avoid Nesting when you're Testing Also moved repetitive strings to a single place ( |
RE: the test changes ... while I'm not under any delusions that the current way is the right way 😄, I'm a little worried about changing the whole testing paradigm in a single file. It's also not clear what tests were added for this functionality. Maybe we can address that approach in a different PR? |
@balazsorban44 - Are you able to wrap this one up in the near future? We're going to put out a release next week and it would be great if this was part of that. My main issue in merging this is the big changes in the logout tests. Would like to see primarily adding there, not a refactor. If you've moved on from the library, let me know and we'll handle it on our end. Thank you! |
Hi, I am back after a long holiday. So to sum up, what is missing so this can be merged? (apart from fixing the conflicts). |
@balazsorban44 - Thanks for checking in. Main thing for me is to just see added tests for this functionality rather than a refactor of how the existing tests work. Also the comment about |
OK, will fix next week 😉 |
Fixed it, but because of the merged in Both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sticking with this @balazsorban44! I fixed those tests in master
so you should be able to rebase and pass here.
Just to be clear, this assumes that any customization it receives is (parameter, config key) is a relative path? Makes sense that it would be consistent across the board.
The one thing we probably want to change here is postLogoutRedirectUri
-> postLogoutRedirectPath
so it's consistent with the other internal path configurations.
Otherwise, looks great!
We are close! (Sorry if it is a bigger task for such a small PR than you expected 😅. If you only wish to be done with this for now, and rather do this discussion later in an issue for example, just give me a word, and I'll just do the required changes so you will be able to include it in the release.) I know it is a bit back-and-forth, but I just looked up some docs before I made the name change: 1. OpenID Connect Session Management says:
2. IdentityServer End Session Endpoint says:
3. ASP.NET Core says:
Auth0 mentions Maybe none of these are relevant in our case, but I just wanted to clarify if you want to go that way, and really call it So I don't say I wouldn't change it to |
Appreciate the research and thought on this @balazsorban44. And no worries about this becoming a long discussion. I would much rather talk this through completely and make a good choice than have to deal with pain points later. I typed out a bunch of stuff and ended up deleting it because the spec does not mention anything about the base domain of those post logout URIs. I was assuming that those needed to be on-site but that's not true according to the spec. As long as it's registered on the OP, then it's fine. I'm going to run this by my team quickly but I'm now in agreement here about the One thing that would be nice here is to accept a path or a URI and append the base URL if it's a path. Does that sound reasonable? |
Yes, supporting both may be the most reasonable decision. :) I will have a look at it. |
dbf9a55
to
6454f80
Compare
Hmm. 🤔 Should full URIs be supported for In that case I could also create an optional UPDATE:
new Error(`returnTo (${returnTo}) URI was not registered in config's postLogoutRedirectUris.`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delayed response here. Let me know if you have any questions about my feedback here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong review type ... comments above.
I reverted my |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks and works like a charm. Thanks @balazsorban44!
@balazsorban44 - I tried to rebase master for you but your branch won't allow pushes. Can you resolve the conflicts here and push? If you're able to rebase the commits to cut down on the number there, that would be helpful as well. |
@joshcanhelp Should be OK now, I did not have any merge conflicts though. |
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
When invoking the default
/logout
endpoint, we will try to attempt to get the returnURL fromreq.query.returnTo
. In addition, I added the possibility to providepost_logout_redirect_uri
in the config ofauth()
, like so:@joshcanhelp I also did a change which I ask you to give a comment on. I moved the session destroy part under the client.endSessionUrl() call, because
req.openid.tokens
becomesundefined
after destroy. After this, my IdP redirects correctly as referred to in the issue referenced under.References
This issue is an improvement after the discussion in #35.
Testing
As of now I only tested it locally, but everything seems to work fine. If requested and/or the way I implemented it is accepted, I can try to create some tests in logout.tests.js
Checklist
Again, if my changes are accepted, I can document the changes.
master