0

我已经将 BorisMorel / LdapBundle 2.0 版集成到 Symfony 2.0.16 版中,^/admin并且可以正常工作,但是有一个问题 - LDAP 包也参与其中,^/api这不是我想要的。API 不应使用 LDAP。我认为添加IS_AUTHENTICATED_ANONYMOUSLYfor ^/apiasaccess_control选项应该会有所帮助,但它没有 - 它正在尝试连接。

安全性.yml:

security:
  firewalls:
    restricted_area:
      pattern:          ^/admin
      anonymous:        ~
      provider:         ldap
      imag_ldap:        ~
      form_login:
        login_path:  /login
        check_path:  /login_check
      logout:
        path:           /logout
        target:         /login

  providers:
    ldap:
      id: imag_ldap.security.user.provider

  encoders:
    IMAG\LdapBundle\User\LdapUser: plaintext

  access_control:
    - { path: ^/api$,  roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    # - { path: ^/,      roles: IS_AUTHENTICATED_FULLY }

  factories:
    - "%kernel.root_dir%/../src/IMAG/LdapBundle/Resources/config/security_factories.xml"

imag_ldap:
  client:
    host: foo.bar.com
    port: 389
    referrals_enabled: 0
    version: 3

  user:
    base_dn: ou=user,dc=bar,dc=com
    name_attribute: uid

  role:
    base_dn: ou=user,dc=bar,dc=com
    name_attribute: cn
    user_attribute: member

问题:我怎样才能“关闭”LDAP ^/api

4

0 回答 0