Kieselerd
Kieselerd

Reputation: 65

Exception in security.yml, because of unexpected ':'

I am new to symfony, and now I get an exception:

The routing file "/Users/alex/myProjectName/src/Custom/CMSBundle/Resources/config/routing.yml" contains unsupported keys for "logout": "pattern". Expected one of: "resource", "type", "prefix", "path", "host", "schemes", "methods", "defaults", "requirements", "options", "condition" in /Users/alex/myProjectName/src/Custom/CMSBundle/Resources/config/routing.yml (which is being imported from "/Users/alex/myProjectName/app/config/routing.yml").

The online linter says this line isn't correct:

found unexpected ':' while scanning a plain scalar at line 18 column 24): user_db: entity: { class: CustomCMSBundle:User, property: username }

    security:
      encoders:
        Symfony\Component\Security\Core\User: plaintext
        Custom\CMSBundle\Entity\User: bcrypt
      role_hierarchy:
        ROLE_ADMIN: [ROLE_USER]
      providers:
        chain_provider:
          chain:
            providers: [in_memory, user_db]
        in_memory:
          memory:
            users:
              admin: { password: adminpass, roles: ROLE_ADMIN }
        user_db:
          entity: { class: CustomCMSBundle:User, property: username }
      firewalls:
        main:
          pattern: /.*
          form_login:
            login_path: /login
            check_path: /login_check
            default_target_path: /
          logout:
            path: /logout
            target: /
          security: true
          anonymous: true
      access_control:
        - { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: /cms/user, roles: ROLE_ADMIN }
        - { path: /.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }

Upvotes: 0

Views: 197

Answers (1)

john Smith
john Smith

Reputation: 17906

maybe try

    user_db:
      entity: { class: Custom\CMSBundle\Entity\User, property: username }

instead of

    user_db:
      entity: { class: CustomCMSBundle:User, property: username }

Upvotes: 0

Related Questions