dbp / relay-core-connector-ldap-bundle
Relay API网关的模板包
v0.2.6
2024-09-11 08:33 UTC
Requires
- php: >=8.1
- ext-json: *
- api-platform/core: ^2.7.11 || ^3.2
- dbp/relay-core-bundle: ^0.1.181
- directorytree/ldaprecord: ^3.5
- illuminate/collections: ^10.48
- psr/cache: ^2.0 || ^3.0
- psr/log: ^2.0 || ^3.0
- symfony/cache: ^5.4 || ^6.4
- symfony/config: ^5.4 || ^6.4
- symfony/dependency-injection: ^5.4 || ^6.4
- symfony/event-dispatcher: ^5.4 || ^6.4
- symfony/event-dispatcher-contracts: ^2.5 || ^3
- symfony/framework-bundle: ^5.4 || ^6.4
- symfony/http-foundation: ^5.4 || ^6.4
- symfony/http-kernel: ^5.4 || ^6.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.50
- phpstan/phpstan: ^1.10.59
- phpstan/phpstan-phpunit: ^1.3.16
- phpunit/phpunit: ^10.1
- symfony/browser-kit: ^5.4 || ^6.4
- symfony/http-client: ^5.4 || ^6.4
- symfony/monolog-bundle: ^3.10
- symfony/phpunit-bridge: ^7.0.4
- vimeo/psalm: ^5.22.2
README
core_connector_ldap 包提供了实现 AuthorizationDataProviderInterface
的代码,用于从 LDAP 服务器检索用户授权数据。
包安装
您可以直接从 packagist.org 安装此包。
composer require dbp/relay-core-connector-ldap-bundle
集成到Relay API服务器
- 将包添加到您的
config/bundles.php
文件中,在DbpRelayCoreBundle
之前
... Dbp\Relay\CoreConnectorLdapBundle\DbpRelayCoreConnectorLdapBundle::class => ['all' => true], Dbp\Relay\CoreBundle\DbpRelayCoreBundle::class => ['all' => true], ];
如果您将 DBP API Server Template 作为您的 Symfony 应用的模板使用,则这应该已经为您生成了。
- 运行
composer install
清除缓存
配置
该包具有 roles
、attributes
和 ldap
配置值,您可以在您的应用程序中指定这些值,无论是通过硬编码还是通过引用环境变量。
为此,在应用程序中创建 config/packages/dbp_relay_core_connector_ldap.yaml
,内容如下
dbp_relay_core_connector_ldap: roles: - name: ROLE_LIBRARY_MANAGER - name: ROLE_LIBRARY_USER attributes: - name: LIBRARY_IDS ldap: host: '%env(LDAP_AUTH_CONNECTOR_LDAP_HOST)%' base_dn: '%env(LDAP_AUTH_CONNECTOR_LDAP_BASE_DN)%' username: '%env(LDAP_AUTH_CONNECTOR_LDAP_USER)%' password: '%env(LDAP_AUTH_CONNECTOR_LDAP_PASS)%' encryption: '%env(LDAP_AUTH_CONNECTOR_LDAP_ENCRYPTION)%' attributes: identifier: '%env(LDAP_AUTH_CONNECTOR_LDAP_ATTRIBUTE_IDENTIFIER)%'
如果您将 DBP API Server Template 作为您的 Symfony 应用的模板使用,则配置文件应该已经为您生成了。
有关包配置的更多信息,请参阅 https://symfony.com.cn/doc/current/bundles/configuration.html。
开发与测试
- 安装依赖项:
composer install
- 运行测试:
composer test
- 运行linters:
composer run lint
- 运行 cs-fixer:
composer run cs-fix
包依赖项
如果您在一个包中安装包,不要忘记从主应用程序中拉取依赖项。
# updates and installs dependencies of dbp/relay-core-connector-ldap-bundle
composer update dbp/relay-core-connector-ldap-bundle