-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Avoiding authentication on every request with Guard #9860
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
Avoiding authentication on every request with Guard #9860
Conversation
security/guard_authentication.rst
Outdated
If you create a Guard login system that's used by a browser and you're experiencing | ||
problems with your session or CSRF tokens, the cause could be bad behavior by your | ||
authenticator. When a Guard authenticator is meant to be used by a browser, you | ||
should *not* authenticate the user on *every* request. On other words, you need to |
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.
"In other words"?
security/guard_authentication.rst
Outdated
} | ||
} | ||
|
||
You'll also need to update your service configuration to ass the token storage: |
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.
typo: pass
Looks good to me, very clear and easy to understand. |
@weaverryan just asking: is this also related to this old pending issue? #5534 |
Hmm, it's not unfortunately :/ Let's merge this PR once the code PR's are merged, as this PR mentions changing your firewall to "stateless" to avoid this issue, which isn't actually true yet in the code. |
This PR was squashed before being merged into the 2.8 branch (closes #27452). Discussion ---------- Avoid migration on stateless firewalls | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | Related to #27395 | License | MIT | Doc PR | symfony/symfony-docs#9860 This is a proof-of-concept. Once we agree / are happy, I need to add this to all of the other authentication mechanisms that recently got the session migration code & add tests. Basically, this avoids migrating the session if the firewall is stateless. There were 2 options to do this: A) Make the `SessionAuthenticationStrategy` aware of all stateless firewalls. **This is the current approach** or B) Make each individual authentication listener aware whether or not *its* firewall is stateless. Commits ------- cca73bb Avoid migration on stateless firewalls
This PR was squashed before being merged into the 2.8 branch (closes #27452). Discussion ---------- Avoid migration on stateless firewalls | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | Related to #27395 | License | MIT | Doc PR | symfony/symfony-docs#9860 This is a proof-of-concept. Once we agree / are happy, I need to add this to all of the other authentication mechanisms that recently got the session migration code & add tests. Basically, this avoids migrating the session if the firewall is stateless. There were 2 options to do this: A) Make the `SessionAuthenticationStrategy` aware of all stateless firewalls. **This is the current approach** or B) Make each individual authentication listener aware whether or not *its* firewall is stateless. Commits ------- cca73bb564 Avoid migration on stateless firewalls
This PR was squashed before being merged into the 2.8 branch (closes #27452). Discussion ---------- Avoid migration on stateless firewalls | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | Related to #27395 | License | MIT | Doc PR | symfony/symfony-docs#9860 This is a proof-of-concept. Once we agree / are happy, I need to add this to all of the other authentication mechanisms that recently got the session migration code & add tests. Basically, this avoids migrating the session if the firewall is stateless. There were 2 options to do this: A) Make the `SessionAuthenticationStrategy` aware of all stateless firewalls. **This is the current approach** or B) Make each individual authentication listener aware whether or not *its* firewall is stateless. Commits ------- cca73bb564 Avoid migration on stateless firewalls
This PR was squashed before being merged into the 2.8 branch (closes #27452). Discussion ---------- Avoid migration on stateless firewalls | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | Related to #27395 | License | MIT | Doc PR | symfony/symfony-docs#9860 This is a proof-of-concept. Once we agree / are happy, I need to add this to all of the other authentication mechanisms that recently got the session migration code & add tests. Basically, this avoids migrating the session if the firewall is stateless. There were 2 options to do this: A) Make the `SessionAuthenticationStrategy` aware of all stateless firewalls. **This is the current approach** or B) Make each individual authentication listener aware whether or not *its* firewall is stateless. Commits ------- cca73bb564 Avoid migration on stateless firewalls
…PasswordJsonAuthenticationListener (weaverryan) This PR was squashed before being merged into the 3.4 branch (closes #27556). Discussion ---------- Avoiding session migration for stateless firewall UsernamePasswordJsonAuthenticationListener | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | Related to #27395 | License | MIT | Doc PR | symfony/symfony-docs#9860 This is the sister PR to #27452, which covered all the other authentication listeners. Commits ------- c06f322 Avoiding session migration for stateless firewall UsernamePasswordJsonAuthenticationListener
…averryan) This PR was squashed before being merged into the 2.8 branch (closes #9860). Discussion ---------- Avoiding authentication on every request with Guard Hi guys! See symfony/symfony#27395 and symfony/symfony#27427 When we're happy with this, I can merge and handle the changes on 3.4, because it will be almost entirely different (with `supports()`, autowiring & the `Security` class - booya for progress!) Commits ------- d2f062a Avoiding authentication on every request with Guard
Hi guys!
See symfony/symfony#27395 and symfony/symfony#27427
When we're happy with this, I can merge and handle the changes on 3.4, because it will be almost entirely different (with
supports()
, autowiring & theSecurity
class - booya for progress!)