security.authentication.success_handler.login.json_login”

问题描述

这是错误: 服务“security.authentication.success_handler.login.json_login”依赖于不存在的服务“lexik_jwt_authentication.handler.authentication_success”。

这是我的 security.yaml

config/packages/security.yaml

安全性: 编码器: 应用\实体\用户: 算法:自动

providers:
    # used to reload user from session & other features (e.g. switch_user)
    app_user_provider:
        entity:
            class: App\Entity\User
            property: email
firewalls:
    login:
        pattern:  ^/api/login
        stateless: true
        anonymous: true
        json_login:
            provider: app_user_provider
            check_path: /api/login_check
            username_path: email
            password_path: password
            success_handler:        lexik_jwt_authentication.handler.authentication_success
            failure_handler:          lexik_jwt_authentication.handler.authentication_failure
    api:
        pattern:   ^/api
        stateless: true
        guard:
         authenticators:
               - lexik_jwt_authentication.jwt_token_authenticator
         
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
    main:
        anonymous: ~
        guard:
         authenticators:
                - App\Security\AppCustomAuthenticatoAuthenticator
              
        logout:
            path: app_logout
            # where to redirect after logout
            # target: app_any_route
 

# ici se trouve votre contenu par défaut

# Dans la partie access_control nous définissons les routes protégées
access_control:
    - { path: ^/Administrateur,roles: ROLE_ADMIN }
    - { path: ^/Etudiants,roles: ROLE_USER }
    - { path: ^/Enseignants,roles: ROLE_USER }
    - { path: ^/api/login,roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/api,roles: IS_AUTHENTICATED_FULLY }
    
# La partie role_hierarchy contient la hiérarchie des rôles
# Un éditeur sera également user
# Un administrateur sera également éditeur et donc user
role_hierarchy:
    ROLE_EDITOR: ROLE_USER
    ROLE_ADMIN: ROLE_EDITOR

这是routes.yaml: api_login_check: 路径:/api/login_check

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)