在运行DB迁移过程中,我会得到这个错误。直到最近还很正常。这个问题是在我们的QA服务器运行管道时失败的DB迁移引起的。当我在迁移容器中查看时,出现了上述错误。
因此,我尝试删除我的本地应用程序并从零开始设置它。在php bin/console doctrine:migrations:migrate期间,出现了错误。

我们使用LexikJWTAuthenticationBundle包来管理该API的JWT身份验证。因此,我猜测可能有一些与LexikJWTAuthenticationBundle相关的缺少的配置,我无法弄清楚。
这是我的config\packages\security.yaml文件的内容。

发布于 2022-01-04 11:40:07
更新到Symfony 5.3 (或更高版本)后,请参阅:https://github.com/lexik/LexikJWTAuthenticationBundle/blob/2.x/Resources/doc/index.md#configuration
修正:
从jwt: ~
lexis_jwt:中的所有内容,并将其替换为api
anonymous: true,您不应该更改lexik_jwt_authentication.yaml文件中的任何内容,但要确保它配置正确(
G 215)
我的示例安全文件(只有管理员可以访问api资源):
security:
enable_authenticator_manager: true
encoders:
App\Entity\User:
algorithm: bcrypt
providers:
database:
entity:
class: App\Entity\User
property: username
firewalls:
dev:
pattern: ^/(_(profiler|wdt|error)|css|images|js)/
security: false
login:
pattern: ^/secured
stateless: true
provider: database
json_login:
check_path: /secured/login_check
username_path: username
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
require_previous_session: false
api:
pattern: ^/api
stateless: true
jwt: ~
access_control:
- { path: ^/secured/login_check$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/secured/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api, roles: ROLE_ADMIN }https://stackoverflow.com/questions/69907037
复制相似问题