使用 LDAP-HTTP-Auth 和默认 Symfony LDAP-Configuration 时出现 Symfony3.1 OptionresolverException
Symfony3.1 OptionresolverException when using LDAP-HTTP-Auth and default Symfony LDAP-Configuration
我正在尝试使用 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"
为什么会出现这个异常?
security.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'
services.yml:
services:
ldap:
class: 'Symfony\Component\Ldap\LdapClient'
arguments:
- dc.company.de # host
- 389 # port
- 3 # version
- false # SSL
- true # TLS
我发现这是 Symfony 中的一个错误。如需更多信息,请参阅:https://github.com/symfony/symfony/issues/19008
我正在尝试使用 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"
为什么会出现这个异常?
security.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'
services.yml:
services:
ldap:
class: 'Symfony\Component\Ldap\LdapClient'
arguments:
- dc.company.de # host
- 389 # port
- 3 # version
- false # SSL
- true # TLS
我发现这是 Symfony 中的一个错误。如需更多信息,请参阅:https://github.com/symfony/symfony/issues/19008