-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Fix the retrieval of the last username when using forwarding #19334
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
return $request->attributes->get(Security::LAST_USERNAME); | ||
} | ||
|
||
$session = $request->getSession(); | ||
|
||
return null === $session ? '' : $session->get(Security::LAST_USERNAME); |
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.
Here, If session does not store Security::LAST_USERNAME
then?
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.
I don't understand what you mean
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.
If $session have not contain "Security::LAST_USERNAME" in this case it should be null.
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.
$session->get()
already return null
if the key is not set.
Thank you @stof. |
…ng forwarding (stof) This PR was merged into the 2.7 branch. Discussion ---------- [Security] Fix the retrieval of the last username when using forwarding | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a When using forwarding to render the login page (which is not the default), the info are stored in the subrequest attributes rather than the session. ``getLastAuthenticationError`` was handling this properly but ``getLastUsername`` was not checking the attributes. This fixes it by checking the attributes (I'm checking them before the session, to be consistent with ``getLastAuthenticationError``) Commits ------- e041365 Fix the retrieval of the last username when using forwarding
When using forwarding to render the login page (which is not the default), the info are stored in the subrequest attributes rather than the session.
getLastAuthenticationError
was handling this properly butgetLastUsername
was not checking the attributes.This fixes it by checking the attributes (I'm checking them before the session, to be consistent with
getLastAuthenticationError
)