jeudi 26 mars 2020

overWrite security.yml fir disable oauth0 generate error "You are not allowed to define new elements for path "security.firewalls"."

I use symfony 4.3. I want to disable oauth0 authentification for behat test environnement and change security.yml but i have error `You are not allowed to define new elements for path "security.firewalls". Please define all elements for this path in one config file.

default security.yml use this bundle for oauth 0 bundle

security:
  providers:
    app_user_provider:
      id: App\Security\UserProvider

  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false
    secured_area:
      pattern: ^/api
      stateless: true
      simple_preauth:
        authenticator: jwt_auth.jwt_authenticator
    static_area:
      pattern: ^/static
      stateless: true
      simple_preauth:
        authenticator: custom_auth

  # Easy way to control access for large sections of your site
  # Note: Only the *first* access control that matches will be used
  access_control:
    - { path: ^/api, roles: ROLE_USER }

TEST security.yml:

security:
  providers:
    app_user_provider:
      id: App\Tests\UserProvider

  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false
    security_area:
      pattern: ^/api
      stateless: true
      guard:
        authenticators:
          - App\Tests\FakeAutehnticator
    static_area:
      pattern: ^/static
      stateless: true
      guard:
        authenticators:
          - App\Tests\FakeAutehnticator

Thanks

Aucun commentaire:

Enregistrer un commentaire