使用symfony的时候,经常会判断用户角色,常见的就是 是否登录
ROLE_ADMIN # 一般会自定义这样一个角色
ROLE_USER # 一般会自定义这样一个角色,Entity 初始化完成以后,会自动生成
PUBLIC_ACCESS
IS_AUTHENTICATED_ANONYMOUSLY #Deprecated: since Symfony 5.4
IS_AUTHENTICATED_FULLY
namespace Symfony\Component\Security\Core\Authorization\Voter;
AuthenticatedVoter
User Deprecated: Since symfony/security-core 5.4:
The "IS_AUTHENTICATED_ANONYMOUSLY" security attribute is deprecated,
use "PUBLIC_ACCESS" for public resources, otherwise use "IS_AUTHENTICATED" or "IS_AUTHENTICATED_FULLY" instead if you want to check if the request is (fully) authenticated.
参考:https://symfony.com/doc/current/security.html#allowing-unsecured-access-i-e-anonymous-users,中 Checking to see if a User is Logged In 部分
