novactive/ezldapauthenticatorbundle

Novactive eZ LDAP Authenticator Bundle,一个用于对LDAP服务器进行用户身份验证的捆绑包

v1.0.1 2019-10-11 07:39 UTC

This package is auto-updated.

Last update: 2024-09-14 14:21:19 UTC


README

此存储库是我们所说的“子树拆分”:主存储库中一个目录的只读副本。Composer使用它来允许开发者依赖于特定的捆绑包。

如果您想报告或贡献力量,您应该在主存储库上打开问题:[https://github.com/Novactive/Nova-eZPlatform-Bundles](https://github.com/Novactive/Nova-eZPlatform-Bundles)

文档可以通过此存储库中的`.md`文件获取,也在此打包:[https://novactive.github.io/Nova-eZPlatform-Bundles/master/LdapAuthenticatorBundle/README.md.html](https://novactive.github.io/Nova-eZPlatform-Bundles/master/LdapAuthenticatorBundle/README.md.html)

Downloads Latest version License

一个用于对LDAP服务器进行用户身份验证的捆绑包

安装

将库添加到您的composer.json中,运行composer require novactive/ezldapauthenticatorbundle以刷新依赖关系。

然后将在您的应用程序的bundles.php中注入捆绑包。

    Novactive\Bundle\eZLDAPAuthenticatorBundle\EzLdapAuthenticatorBundle::class => [ 'all'=> true ],

配置

捆绑包配置

要配置此捆绑包,您应在您的config.yml文件中添加新的nova_ez_ldap部分。基本的配置可能如下所示

nova_ez_ldap:
  connections:
    default:
      ldap:
        adapter:
          connection_string: '%ldap_connection_string%'
        user_provider:
          base_dn: '%ldap_base_dn%'
          search_dn: '%ldap_read_only_user%'
          search_password: '%ldap_read_only_password%'
          uid_key:              uid
      ezuser:
        admin_user_id:  '%admin_user_id%'
        user_group_id:  '%target_usergroup%'
        email_attr: mail
        attributes:
          first_name: givenName
          last_name: sn

您可以选择设置connection_string,也可以单独设置hostportencryptionversion。您还可以设置一个直接传递给Symfony Ldap组件的options数组。

LDAP属性映射

要能够存储来自LDAP的用户,您必须配置LDAP属性和eZPublish用户字段之间的映射。您必须在ezuser部分中映射所有必需的字段。默认情况下,eZPublish需要用户凭据和电子邮件,但您可能在您的User内容类中具有任何额外的字段,因此您应该填写所有这些字段。

目标组

所有用户都将存储在组user_group_id中。您必须在此处放置组内容ID。

完整的默认配置

以下是完整的默认捆绑包配置

nova_ez_ldap:
  connections:
    default:
      ldap:
        adapter:
          connection_string: ~
          host: localhost
          port: 389
          version: 3
          encryption: none # One of "none"; "ssl"; "tls"
          options: []

        user_provider:
          base_dn: ~ # Required
          search_dn: ~ # Required
          search_password: ~ # Required
          uid_key: uid
          filter: '({uid_key}={username})'

      ezuser:
        admin_user_id:  ~ # Required
        user_group_id:  ~ # Required
        email_attr:  ~ # Required
        attributes:
          user_attr: ldap_attr

安全配置

除了常见的捆绑包配置之外,您还必须在security部分添加一些参数

security:
    providers:
        chain_provider:
            chain:
                providers: [nova_ldap, ezpublish]
        ezpublish:
            id: ezpublish.security.user_provider
        nova_ldap:
            id: nova_ez.ldap.user_provider
    firewalls:
        ezpublish_front:
            form_login_ldap:
                service: nova_ez.ldap
                provider: chain_provider