2

我正在尝试使用 symfony 3.1 构建一个针对 ActiveDirectory 进行身份验证的应用程序。我从http://symfony.com/doc/current/cookbook/security/ldap.html获取配置并更改了公司特定参数。我还通过 Composer 安装了 Symfony\Ldap - 组件。首先,我想将 HTTP-Basic-Auth 机制与 LDAP 一起使用,由 Symfony 提供。浏览器询问用户名和密码,但是当您同时提交两者时,会出现以下异常:

The options "optReferrals", "useSsl", "useStartTls" do not exist. Defined options are: "connection_string", "debug", "encryption", "host", "options", "port", "referrals", "version"

为什么会出现这个异常?

安全性.yml:

security:
access_control:
    - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/, roles: ROLE_USER }
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
   in_memory:
        memory: ~
   ad_ldap:
    ldap:
      service: ldap
      base_dn: DC=company,DC=de
      search_dn: "CN=ldap-user,OU=Service-Accounts,OU=Administration,DC=company,DC=de"
      search_password: password
      default_roles: ROLE_USER
      uid_key: sAMAccountName            
firewalls:
    # disables authentication for assets and the profiler, adapt it according to your needs
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
    login_firewall:
        pattern:   ^/login$
        anonymous: ~
    main:
        #provider: in_memory
        anonymous: ~
        # activate different ways to authenticate

        # http_basic: ~
        # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate

        # form_login: ~
        # http://symfony.com/doc/current/cookbook/security/form_login_setup.html
        provider: ad_ldap
        pattern:  ^/
        logout:
            path:   logout
            target: /
        http_basic_ldap:
            service: ldap
            dn_string: 'uid={username},OU=Users,OU=Resources,DC=company,DC=de'

服务.yml:

services:
    ldap:
       class: 'Symfony\Component\Ldap\LdapClient'
       arguments:
            - dc.company.de   # host
            - 389         # port
            - 3           # version
            - false       # SSL
            - true        # TLS
4

1 回答 1

0

I found that this is a bug in Symfony. For further information see: https://github.com/symfony/symfony/issues/19008

于 2016-06-09T15:43:48.873 回答