1

我已经security.yml为我的网站实现了一个文件。它使用两个不同的提供程序用于两个不同的登录表单。当我在一个认证区域被认证并且我去公共区域(匿名区域)时,我丢失了我的身份信息并且我得到一个“你没有被认证”。在调试栏中。

站点地图是这样的:

  • 家,常见问题...(匿名)
  • 专业/经理(与专业安全提供商进行身份验证)
  • 用户(与 customer_security 提供商进行身份验证)

    security:
     encoders:
       Project\SiteBundle\Entity\User: 
           algorithm:        sha512
           encode_as_base64: true
           iterations:       1            
       Project\SiteBundle\Entity\Professional: 
           algorithm:        sha512
           encode_as_base64: true
           iterations:       1
    providers:
      customer_security:
        entity: 
          class: Project\SiteBundle\Entity\User
          property: login
      professional_security:
        entity: 
          class: Project\SiteBundle\Entity\Professional
          property: login 
    
    firewalls:
        dev:
          pattern:  ^/(_(profiler|wdt)|css|images|js)/
          security: true
          anonymous: ~
    
        Public_area:
         pattern: ^/
         anonymous: ~
    
        Professional:
          pattern: ^/professional/.*
          anonymous: ~
          provider: professional_security
          form_login:
              login_path: /professional/login
              check_path: /professional/login_check
              success_handler: authentication_handler
          logout:
              path: /professional/logout
              target: /professional/login
          security: true
    
        Customer:
          pattern: ^/user/.*
          provider: customer_security
          form_login:
            login_path: /user/login
            check_path: /user/login_check
            success_handler: authentication_handler
          logout:
            path: /user/logout
            target: /user/login
          security: true
    
     access_control:
      - { path: ^/professional/login, roles: IS_AUTHENTICATED_ANONYMOUSLY}
      - { path: ^/user/login, roles: IS_AUTHENTICATED_ANONYMOUSLY}
      - { path: ^/user/register, roles: IS_AUTHENTICATED_ANONYMOUSLY}
      - { path: ^/professional/.*, roles: IS_AUTHENTIFICATED_FULLY}
      - { path: ^/professional/beautician/.*, roles: ROLE_BEAUTICIAN}
      - { path: ^/professional/manager/.*, roles: ROLE_MANAGER}
      - { path: /user/.*, roles: ROLE_CUSTOMER}
      - { path: ^/faq, roles: IS_AUTHENTICATED_ANONYMOUSLY}
    
4

0 回答 0