Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Updated code example for LDAP integration#7917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
pmlt wants to merge5 commits intosymfony:3.2frompmlt:update_ldap_code_example
Closed
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 39 additions & 23 deletionssecurity/ldap.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,8 +49,8 @@ The providers are configured to use a default service named ``ldap``,
but you can override this setting in the security component's
configuration.

An LDAP client can be simply configured, using thefollowing service
definition:
An LDAP client can be simply configured using thebuilt-in ``ldap`` PHP
extension with the following servicedefinition:

.. configuration-block::

Expand All@@ -59,13 +59,17 @@ definition:
# app/config/services.yml
services:
ldap:
class: Symfony\Component\Ldap\LdapClient
class: Symfony\Component\Ldap\Ldap
arguments: ['@ext_ldap_adapter']
ext_ldap_adapter:
class: Symfony\Component\Ldap\Adapter\ExtLdap\Adapter
arguments:
- my-server # host
- 389 # port
- 3 # version
- false # SSL
- true # TLS
- host: my-server
port: 389
encryption: tls
options:
protocol_version: 3
referrals: false

.. code-block:: xml

Expand All@@ -76,31 +80,43 @@ definition:
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="ldap" class="Symfony\Component\Ldap\LdapClient">
<argument>my-server</argument>
<argument>389</argument>
<argument>3</argument>
<argument>false</argument>
<argument>true</argument>
<service id="ldap" class="Symfony\Component\Ldap\Ldap">
<argument type="service" id="ext_ldap_adapter" />
</service>
<service id="ext_ldap_adapter" class="Symfony\Component\Ldap\Adapter\ExtLdap\Adapter">
<argument type="collection">
<argument key="host">my-server</argument>
<argument key="port">389</argument>
<argument key="encryption">tls</argument>
<argument key="options" type="collection">
<argument key="protocol_version">3</argument>
<argument key="referrals">false</argument>
</argument>
</argument>
</service>
</services>
</container>

.. code-block:: php

// app/config/services.php
use Symfony\Component\Ldap\LdapClient;
use Symfony\Component\Ldap\Ldap;
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
use Symfony\Component\DependencyInjection\Definition;

$container->register('ldap', Ldap::class)
->addArgument(new Reference('ext_ldap_adapter'));

$container
->setDefinition('ldap', new Definition(LdapClient::class, array(
'my-server',
389,
3,
false,
true,

));
->setDefinition('ext_ldap_adapter', new Definition(Adapter::class, array(
'host' => 'my-server',
'port' => 389,
'encryption' => 'tls',
'options' => array(
'protocol_version' => 3,
'referrals' => false
)
)));

Fetching Users Using the LDAP User Provider
-------------------------------------------
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp