-
Notifications
You must be signed in to change notification settings - Fork 360
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
feat: Add url_param config option to redirect error handler. #511
feat: Add url_param config option to redirect error handler. #511
Conversation
This change introduces a url_param config option for redirect error handler. If it contains a url paramter name, the redirect url will have this parameter set, containing the current url (from which Oathkeeper has redirected the user). This can be useful in passing the return_to url to Kratos, so user can be redirected to the page they initially wanted to access after a successfull sign in.
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.
Nice, thanks for your contribution 👍
I just found some go specific mistakes.
Thank You so much for the fixes! Oyoyoy that shadowing of a library was nasty >:-} |
Co-authored-by: Patrik <[email protected]>
Co-authored-by: Patrik <[email protected]>
Co-authored-by: Patrik <[email protected]>
Co-authored-by: Patrik <[email protected]>
Co-authored-by: Patrik <[email protected]>
Co-authored-by: Patrik <[email protected]>
Co-authored-by: Patrik <[email protected]>
Co-authored-by: Patrik <[email protected]>
Sorry, I clicked accept suggestions which resulted in multiple commints. This PR should be merged-squashed probably. |
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.
Nice thanks
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.
Thank you, this looks great! I have some ideas how to improve this. Could you also please add some docs to: https://github.com/ory/oathkeeper/blob/master/docs/docs/pipeline/error.md#redirect ? :)
.schema/config.schema.json
Outdated
@@ -260,6 +260,13 @@ | |||
], | |||
"default": 302 | |||
}, | |||
"url_param": { |
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.
Let's rename this to return_to_query_param
to make it more obvious :)
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.
@aeneasr done
@aeneasr Hi, is there some way I can improve on this PR more? |
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.
Sorry, I'm currently on vacation which is why these reviews take a bit longer :) This looks great! Could you please resolve the merge conflicts? Then I'll be merging it right away! :)
@marcinkoziej Great job! |
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.
Awesome 🎉
Thank you for your contribution!
@marcinkoziej @aeneasr Thanks a lot! I have compiled oathkeeper from source and the feature works! |
This change introduces a url_param config option for redirect error handler.
If it contains a url paramter name, the redirect url will have this parameter
set, containing the current url (from which Oathkeeper has redirected the user).
This can be useful in passing the return_to url to Kratos, so user can be
redirected to the page they initially wanted to access after a successfull sign in.
Related issue
https://community.ory.sh/t/how-to-use-the-return-to-query-string-with-oathkeeper-kratos/2149/6
Proposed changes
Add
url_param
option to redirect error config, which configures a name of paramter that should contain current url (the url that failed the pipeline).If url_param is given, the redirect error handler will parse the
to:
url and appendurl_param
parameter with current url.Checklist
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
[email protected]) from the maintainers to push
the changes.
works.