1

Hello i have this error :

Unrecognized options "0, 1" under "security.firewalls.access_control". Available options are "access_denied_handler", "access_denied_url", "anonymous", "context", "custom_authenticators", "entry_point", "form_login", "form_login_ldap", "guard", "host", "http_basic", "http_basic_ldap", "json_login", "json_login_ldap", "lazy", "lexik_jwt", "logout", "methods", "pattern", "provider", "remember_me", "remote_user", "request_matcher", "security", "stateless", "switch_user", "user_checker", "x509".

Someone know where i need modify something for fix this error ?

For information i look in the file security.yaml:

security:
    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        users:
            entity:
                # the class of the entity that represents users
                class: 'App\Entity\Customer'
                # property: customername
    # added by me for configure security bundle
    enable_authenticator_manager: true
    encoders:
        # use your user class name here
        App\Entity\Customer:
            # Use native password encoder
            # This value auto-selects the best possible hashing algorithm
            # (i.e. Sodium when available).
            algorithm: auto
    firewalls:
        login:
            pattern: ^/api/login
            stateless: true
            anonymous: true
            json_login:
                check_path: /api/login_check
                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
        access_control:
            - { path: ^/api/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/api,       roles: IS_AUTHENTICATED_FULLY }
rugolinifr
  • 1,211
  • 1
  • 5
  • 11
khyshant
  • 11
  • 2
  • Pretty weird, did you clear the cache just in case ? – FTW Sep 13 '20 at 14:07
  • You could try setting enable_authenticator_manager back to false. Right now you are mixing the older style of authenticators (json_login) with the newer guard only approach. Just a guess. – Cerad Sep 13 '20 at 14:28
  • yes i did it now, but i have the same error – khyshant Sep 13 '20 at 14:29
  • @cerad i do it but the error is the same. – khyshant Sep 13 '20 at 14:30
  • Symfony version? Double check for syntax errors and what not. I installed the jwt bundle on a fresh 5.1 project and added the firewalls. No problem though setting enable_authenticator_manager to true generated other errors as expected. Makes me think you have other stuff going on. Consider creating a fresh project, installing just the jwt bundle and then see if you can reproduce the issue. – Cerad Sep 13 '20 at 14:46
  • @cerad, thx i do that and recome :) – khyshant Sep 13 '20 at 15:10
  • 1
    Turned out to be quite simple. Just noticed that your access_control section is indented by an extra 4 spaces. At first I though it was just a copy/paste issue but I indented my test case and got the same error. access_control is it's own section and does not belong under the firewall section. But at least I know what the error message looks like now. Still need to set enable_authenticator_manager to false. – Cerad Sep 14 '20 at 12:55

0 Answers0