我刚刚用 LexikJWTAuthenticationBundle2.4 测试了 symfony flex,我跟着 这里
错误是NotFoundHttpException 找不到路径“/login_check”的控制器。路由配置错误。
我必须创建一个控制器吗?没有把握!或者愚蠢是什么
这是我的安全文件:
security:
encoders:
App\Entity\User:
algorithm: bcrypt
providers:
entity_provider:
entity:
class: App\Entity\User
property: username
users:
id: App\Metier\Provider\UserProvider
firewalls:
login:
pattern: ^/login
stateless: true
anonymous: true
json_login:
provider: users
check_path: /login_check
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
register:
pattern: ^/register
stateless: true
anonymous: true
api:
pattern: ^/api
stateless: true
provider: entity_provider
anonymous: false
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
access_control:
- { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api/personnel, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
我的 route.yml 和我的私钥:
api_login_check:
path: /login_check
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,1F2589373C3622EADA0262E3D18FBA51
预先感谢您的帮助