Skip to content

[Security] Added documentation for IS_AUTHENTICATED #17226

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

Merged
merged 1 commit into from
Aug 31, 2022
Merged

[Security] Added documentation for IS_AUTHENTICATED #17226

merged 1 commit into from
Aug 31, 2022

Conversation

artyuum
Copy link
Contributor

@artyuum artyuum commented Aug 24, 2022

I believe that this part of the doc is wrong or might be confusing. In order to check if the user is simply logged in, they are suggesting using the IS_AUTHENTICATED_FULLY attribute. But later below, we learn that this attribute is the "stronger" one and that it cannot be used in that context because:

This is similar to IS_AUTHENTICATED_REMEMBERED, but stronger. Users who are logged in only because of a "remember me cookie" will have IS_AUTHENTICATED_REMEMBERED but will not have IS_AUTHENTICATED_FULLY.

So the appropriate attribute should have been IS_AUTHENTICATED_REMEMBERED:

All logged-in users have this, even if they are logged in because of a "remember me cookie". Even if you don't use the remember me functionality, you can use this to check if the user is logged in.

But unfortunately, its name is misleading and it took me some long minutes to understand it and why it has been named like that.

After digging into the AuthenticatedVoter for a better understanding of these attributes, I stumbled upon an undocumented attribute called IS_AUTHENTICATED.

I believe that this attribute should be present in the doc and should become the recommended one when checking if a user is simply logged in because its name is obviously clearer and better describes its intent.

I'm not sure why it's not documented but it has been brought by this symfony/symfony@e3aca7f.

@javiereguiluz
Copy link
Member

@artyuum thanks for improving the docs!

@artyuum artyuum deleted the is-authenticated branch August 31, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants