wiser/ldap-user-provider-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wiser/ldap-user-provider-bundle

最新稳定版本:3.0

Composer 安装命令:

composer require wiser/ldap-user-provider-bundle

包简介

LDAP user provider bundle for Symfony 6.4

README 文档

README

This bundle provides LDAP authentication. It can also be used for authorization by retrieving the groups to which users belong and setting them as roles. It relies on the standard ldap php extension.

Dependencies

- it should be compliant with Symfony 3.4, 4.4 and 5.4
- ext-ldap
- symfony/ldap

Get the Bundle with composer

composer require wiser/ldap-user-provider-bundle

Configure services.yaml

# config/services.yaml
parameters:
    ldap.host: 'dc.company.com'
    ldap.port: '389'
    ldap.user: 'user'               # administrative account used to bind user/password
    ldap.password: 'password'
    ldap.base_dn: 'dc=COMPANY,dc=ORG'
    ldap.roles_ou_filter: 'OU=APPLICATIONS,OU=GROUPS'

services:
    Symfony\Component\Ldap\Adapter\ExtLdap\Adapter:
        arguments:
            -   host: '%ldap.host%'
                port: '%ldap.port%'

    Symfony\Component\Ldap\Ldap:
        arguments: ['@Symfony\Component\Ldap\Adapter\ExtLdap\Adapter']

Configure security.yaml

# config/packages/security.yaml

security:
    providers:
        my_ldap:
            wiser_ldap: # this is the configuration key that matches this bundle
                service: Symfony\Component\Ldap\Ldap
                base_dn: '%ldap.base_dn%'
                search_dn: '%ldap.user%'
                search_password: '%ldap.password%'
                roles_ou_filter: '%ldap.roles_ou_filter%'
# there are other configuration settings, check the code (LdapUserProviderFactory.php) to find them by yourself ;)

    firewalls:
        restricted_area:
            anonymous: true
            form_login_ldap: ldap
                login_path: login
                    check_path: login
                    csrf_token_generator: security.csrf.token_manager
                    service: Symfony\Component\Ldap\Ldap
                    dn_string: '%ldap.base_dn%'
                    search_dn: '%ldap.user%'
                    search_password: '%ldap.password%'
                    query_string: (&(ObjectClass=Person)(sAMAccountName={username}))
                    provider: my_ldap

Note:

You can refer to the official Symfony documentation : https://symfony.com/doc/current/security/ldap.html

统计信息

  • 总下载量: 12.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: apache-2.0
  • 更新时间: 2020-08-29