Skip to content

Commit 37e2349

Browse files
committed
Add role_fetcher option to LDAP security configuration
The `role_fetcher` option allows defining a service to fetch user roles from the LDAP server by implementing `RoleFetcherInterface`. This option was introduced in Symfony 7.3, and it supersedes `default_roles` when set. The `MemberOfRoles` implementation can be used to retrieve roles from the `ismemberof` attribute.
1 parent 08a3431 commit 37e2349

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

security/ldap.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,23 @@ This is the default role you wish to give to a user fetched from the LDAP
256256
server. If you do not configure this key, your users won't have any roles,
257257
and will not be considered as authenticated fully.
258258

259+
role_fetcher
260+
............
261+
262+
**type**: ``string`` **default**: ``null``
263+
264+
When your LDAP service provides user roles, you can use this configuration option
265+
to define the role fetcher service. The role fetcher service must implement the
266+
``Component\Ldap\Security\RoleFetcherInterface`` interface.
267+
``default_roles`` is ignored when ``role_fetcher`` is set.
268+
269+
``Symfony\Component\Ldap\Security\MemberOfRoles`` is a concrete implementation
270+
of the ``RoleFetcherInterface`` that fetches roles from the ``ismemberof`` attribute.
271+
272+
.. versionadded:: 7.3
273+
274+
The configuration option ``role_fetcher`` was introduced in Symfony 7.3.
275+
259276
uid_key
260277
.......
261278

0 commit comments

Comments
 (0)