使用 in_memory 安全用户时的弃用通知
Deprecation notice when using in_memory security user
运行 Symfony 3.3.15 我目前在自动装配机制方面遇到了一些问题。
以下弃用警告在我的日志中出现了 3 次:
Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won't be supported in version 4.0. You should rename (or alias) the "security.user.provider.concrete.in_memory_info@website.xyz" service to "Symfony\Component\Security\Core\User\UserInterface" instead.
我能想到的唯一会发生此错误的地方是我的 security.yml
,因为我已经在那里定义了用户。
该文件包含以下内容:
security:
encoders:
My\Bundle\CompanyBundle\Entity\Contact:
algorithm: bcrypt
Symfony\Component\Security\Core\User\User:
algorithm: bcrypt
providers:
chain_provider:
chain:
providers: [in_memory, contact_provider]
in_memory:
memory:
users:
info@website.xys:
password: "some encrypted password"
roles: ["ROLE_SUPER_ADMIN"]
contact_provider:
entity:
class: MyCompanyBundle:Contact
property: emailAddress
api_user_provider:
entity:
class: ApiBundle:ApiUser
property: apiKey
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
api:
pattern: ^/
stateless: true
provider: api_user_provider
guard:
authenticators:
- App\Component\Security\TokenAuthenticator
main:
anonymous: ~
provider: chain_provider
form_login:
username_parameter: login[username]
password_parameter: login[password]
csrf_parameter: login[_token]
login_path: login
check_path: login
logout:
path: /logout
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
即使我在此文件中只指定 in_memory 提供程序,警告也会不断弹出。
有什么想法吗?
这似乎是一个错误,用户已注册为服务。
从 Symfony 2.7 开始修复:https://github.com/symfony/symfony/pull/25837
运行 Symfony 3.3.15 我目前在自动装配机制方面遇到了一些问题。
以下弃用警告在我的日志中出现了 3 次:
Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won't be supported in version 4.0. You should rename (or alias) the "security.user.provider.concrete.in_memory_info@website.xyz" service to "Symfony\Component\Security\Core\User\UserInterface" instead.
我能想到的唯一会发生此错误的地方是我的 security.yml
,因为我已经在那里定义了用户。
该文件包含以下内容:
security:
encoders:
My\Bundle\CompanyBundle\Entity\Contact:
algorithm: bcrypt
Symfony\Component\Security\Core\User\User:
algorithm: bcrypt
providers:
chain_provider:
chain:
providers: [in_memory, contact_provider]
in_memory:
memory:
users:
info@website.xys:
password: "some encrypted password"
roles: ["ROLE_SUPER_ADMIN"]
contact_provider:
entity:
class: MyCompanyBundle:Contact
property: emailAddress
api_user_provider:
entity:
class: ApiBundle:ApiUser
property: apiKey
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
api:
pattern: ^/
stateless: true
provider: api_user_provider
guard:
authenticators:
- App\Component\Security\TokenAuthenticator
main:
anonymous: ~
provider: chain_provider
form_login:
username_parameter: login[username]
password_parameter: login[password]
csrf_parameter: login[_token]
login_path: login
check_path: login
logout:
path: /logout
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
即使我在此文件中只指定 in_memory 提供程序,警告也会不断弹出。
有什么想法吗?
这似乎是一个错误,用户已注册为服务。
从 Symfony 2.7 开始修复:https://github.com/symfony/symfony/pull/25837