Service not recognized by Symfony

Viewed 164

I have a concern with the following service in my project:

app.security.guardAuthenticatorLoginPassword:
      class: AppBundle\Security\LoginPasswordAuthenticator
      arguments: ["@router"]
app.jwt_token_authenticator:
      class: AppBundle\Security\JwtAuthenticator
      arguments: ['@doctrine.orm.entity_manager', '@lexik_jwt_authentication.encoder']

I feel that whatever I do it is not recognized by my program ..

I have been looking for a few hours already but I do not understand why it does not work. While I have both my LoginPasswordAuthenticator and JwtAuthenticator classes in the specified path ..

Thank you in advance for your help

1 Answers

Here is some potentials issues:
_ Clear the cache
_ Check if you didn't forget a 'use' for your differents classes
_ Give to your services a name (and why not an alias) and use it when you call your service:

app.security.guardAuthenticatorLoginPassword:
  class: AppBundle\Security\LoginPasswordAuthenticator
  arguments: ["@router"]
  tags:
      - { name: login.password.authenticator, alias: login.auth }

app.jwt_token_authenticator:
  class: AppBundle\Security\JwtAuthenticator
  arguments:['@doctrine.orm.entity_manager','@lexik_jwt_authentication.encoder']
  tags:
      - { name: security.authenticator, alias: security.auth }
Related