【问题标题】:Deprecation notice when using in_memory security user使用 in_memory 安全用户时的弃用通知
【发布时间】:2018-06-18 15:23:06
【问题描述】:

运行 Symfony 3.3.15 我目前在自动装配机制方面遇到了一些问题。

以下弃用警告在我的日志中出现了 3 次:

自 Symfony 3.3 起,基于它们实现的类型的自动装配服务已被弃用,并且在 4.0 版中将不再支持。您应该将“security.user.provider.concrete.in_memory_info@website.xyz”服务重命名(或别名)为“Symfony\Component\Security\Core\User\UserInterface”。

我可以想象这个错误发生的唯一地方是我的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 提供程序,警告也会不断弹出。

有什么想法吗?

【问题讨论】:

    标签: php symfony symfony-3.3 symfony-security


    【解决方案1】:

    这似乎是一个错误,用户被注册为服务。

    从 Symfony 2.7 开始修复:https://github.com/symfony/symfony/pull/25837

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-11
      • 1970-01-01
      • 2021-11-07
      相关资源
      最近更新 更多