vendor/blackbit_digital_commerce/pimcore-ldap/src/DependencyInjection/Configuration.php line 33

Open in your IDE?
  1. <?php
  2. /**
  3.  * GMDE S.R.L.
  4.  *
  5.  * This source file is subject to the GNU General Public License version 3 (GPLv3)
  6.  * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
  7.  * files that are distributed with this source code.
  8.  *
  9.  * @copyright  Copyright (c) 2018 GMDE S.R.L. (https://www.gmde.it)
  10.  * @license    GNU General Public License version 3 (GPLv3)
  11.  * @author     Alessandro Pozzi (a.pozzi@gmde.it)
  12.  */
  13. namespace Alep\LdapBundle\DependencyInjection;
  14. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  15. use Symfony\Component\Config\Definition\ConfigurationInterface;
  16. /**
  17.  * This is the class that validates and merges configuration from your app/config files.
  18.  *
  19.  * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
  20.  */
  21. class Configuration implements ConfigurationInterface
  22. {
  23.     /**
  24.      * {@inheritdoc}
  25.      */
  26.     public function getConfigTreeBuilder()
  27.     {
  28.         $treeBuilder = new TreeBuilder();
  29.         $rootNode $treeBuilder->root('alep_ldap');
  30.         $rootNode
  31.             ->children()
  32.                 ->booleanNode('enabled')
  33.                     ->defaultValue(false)
  34.                 ->end()
  35.                 ->scalarNode('service')
  36.                     ->info('This is the name of your configured LDAP client. You can freely chose the name, but it must be unique in your application and it cannot start with a number or contain white spaces.')
  37.                     ->isRequired()
  38.                     ->cannotBeEmpty()
  39.                     ->defaultValue('Symfony\Component\Ldap\Ldap')
  40.                 ->end()
  41.                 ->scalarNode('base_dn')
  42.                     ->info('This is the base DN for the directory')
  43.                     ->defaultNull()
  44.                 ->end()
  45.                 ->scalarNode('search_dn')
  46.                     ->info('This is your read-only user\'s DN, which will be used to authenticate against the LDAP server in order to fetch the user\'s information.')
  47.                     ->defaultNull()
  48.                 ->end()
  49.                 ->scalarNode('search_password')
  50.                     ->info('This is your read-only user\'s password, which will be used to authenticate against the LDAP server in order to fetch the user\'s information.')
  51.                     ->defaultNull()
  52.                 ->end()
  53.                 ->arrayNode('default_roles')
  54.                     ->info('This is the default roles you wish to give to a user fetched from the LDAP server. If you do not configure this key, your users won\'t have any roles, and will not be considered as authenticated fully.')
  55.                     ->scalarPrototype()->end()
  56.                 ->end()
  57.                 ->scalarNode('uid_key')
  58.                     ->info('This is the entry\'s key to use as its UID. Depends on your LDAP server implementation.')
  59.                     ->isRequired()
  60.                     ->cannotBeEmpty()
  61.                     ->defaultValue('sAMAccountName')
  62.                 ->end()
  63.                 ->scalarNode('filter')
  64.                     ->info('This key lets you configure which LDAP query will be used. The {uid_key} string will be replaced by the value of the uid_key configuration value (by default, sAMAccountName), and the {username} string will be replaced by the username you are trying to load.')
  65.                     ->isRequired()
  66.                     ->cannotBeEmpty()
  67.                     ->defaultValue('({uid_key}={username})')
  68.                 ->end()
  69.                 ->arrayNode('exclude')
  70.                     ->info('This is a list of usernames to exclude from LDAP authentication.')
  71.                     ->setDeprecated('The "%node%" option is deprecated. Use "exclude_rules" instead.')
  72.                     ->scalarPrototype()->end()
  73.                 ->end()
  74.                 ->arrayNode('exclude_rules')
  75.                     ->info('This is a list of usernames/roles to exclude from LDAP authentication (supports regular expressions).')
  76.                     ->children()
  77.                         ->arrayNode('users')->scalarPrototype()->end()->end()
  78.                         ->arrayNode('roles')->scalarPrototype()->end()->end()
  79.                     ->end()
  80.                 ->end()
  81.                 ->scalarNode('mapper')
  82.                     ->info('This is the data mapper service used to map ldap user data to Pimcore user.')
  83.                     ->cannotBeEmpty()
  84.                     ->defaultValue('Alep\LdapBundle\DataMapper\DefaultLdapUserMapper')
  85.                 ->end()
  86.                 ->scalarNode('logger')
  87.                     ->info('This is the logger service used by the bundle.')
  88.                 ->end()
  89.             ->end()
  90.         ;
  91.         return $treeBuilder;
  92.     }
  93. }