-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Adding new TargetPathTrait to get/set the authentication "target_path" #17714
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
Conversation
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Security\Http\Helper; |
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.
why "Helper" instead of the more common "Util" namespace?
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.
No reason :) I changed to Util
f70cf5b
to
f957015
Compare
…" URL to the session This allows this method to be easily re-used inside custom authentication schemes.
9f786ab
to
4b041dc
Compare
ping @symfony/deciders |
👍 |
trait TargetPathTrait | ||
{ | ||
/** | ||
* Set the target path the user should be redirected to after authentication. |
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.
Sets
👍 |
👍 Status: Reviewed |
Thank you @weaverryan. |
This PR was merged into the 3.1-dev branch. Discussion ---------- [Guard] fix minimum required Seucirty Http version | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17714 | License | MIT | Doc PR | Otherwise, the `TargetPathTrait` is not available. Commits ------- 952bf01 [Guard] fix minimum required Seucirty Http version
@weaverryan I find myself setting this path quite often manually, so this is a nice one. Will it allow us to set the |
Hi guys!
This is a small guy. Basically, when you're doing custom auth (i.e. a guard authenticator), it's common to need the previous URL the user tried to get to (i.e. the "target path"). It's not much work to do it now, but it's very abstract - needing to know a weird string pattern. This just wraps that weirdness up in a simple function (
getTargetPath()
).Thanks!