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

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. use Symfony\Component\HttpKernel\Kernel;
  17. /**
  18.  * This is the class that validates and merges configuration from your app/config files.
  19.  *
  20.  * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
  21.  */
  22. class Configuration implements ConfigurationInterface
  23. {
  24.     /**
  25.      * {@inheritdoc}
  26.      */
  27.     public function getConfigTreeBuilder()
  28.     {
  29.         $kernelVersion Kernel::MAJOR_VERSION;
  30.         if ($kernelVersion >= 5) {
  31.             $treeBuilder = new TreeBuilder('alep_ldap');
  32.             $rootNode $treeBuilder->getRootNode();
  33.         } else {
  34.             $treeBuilder = new TreeBuilder();
  35.             $rootNode $treeBuilder->root('alep_ldap');
  36.         }
  37.         $rootNode
  38.             ->children()
  39.                 ->booleanNode('enabled')
  40.                     ->defaultValue(false)
  41.                 ->end()
  42.                 ->scalarNode('service')
  43.                     ->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.')
  44.                     ->isRequired()
  45.                     ->cannotBeEmpty()
  46.                     ->defaultValue('Symfony\Component\Ldap\Ldap')
  47.                 ->end()
  48.                 ->scalarNode('base_dn')
  49.                     ->info('This is the base DN for the directory')
  50.                     ->defaultNull()
  51.                 ->end()
  52.                 ->scalarNode('search_dn')
  53.                     ->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.')
  54.                     ->defaultNull()
  55.                 ->end()
  56.                 ->scalarNode('search_password')
  57.                     ->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.')
  58.                     ->defaultNull()
  59.                 ->end()
  60.                 ->arrayNode('default_roles')
  61.                     ->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.')
  62.                     ->scalarPrototype()->end()
  63.                 ->end()
  64.                 ->scalarNode('uid_key')
  65.                     ->info('This is the entry\'s key to use as its UID. Depends on your LDAP server implementation.')
  66.                     ->isRequired()
  67.                     ->cannotBeEmpty()
  68.                     ->defaultValue('sAMAccountName')
  69.                 ->end()
  70.                 ->scalarNode('filter')
  71.                     ->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.')
  72.                     ->isRequired()
  73.                     ->cannotBeEmpty()
  74.                     ->defaultValue('({uid_key}={username})')
  75.                 ->end()
  76.                 ->arrayNode('exclude')
  77.                     ->info('This is a list of usernames to exclude from LDAP authentication.')
  78.                     ->setDeprecated('The "%node%" option is deprecated. Use "exclude_rules" instead.')
  79.                     ->scalarPrototype()->end()
  80.                 ->end()
  81.                 ->arrayNode('exclude_rules')
  82.                     ->info('This is a list of usernames/roles to exclude from LDAP authentication (supports regular expressions).')
  83.                     ->children()
  84.                         ->arrayNode('users')->scalarPrototype()->end()->end()
  85.                         ->arrayNode('roles')->scalarPrototype()->end()->end()
  86.                     ->end()
  87.                 ->end()
  88.                 ->scalarNode('mapper')
  89.                     ->info('This is the data mapper service used to map ldap user data to Pimcore user.')
  90.                     ->cannotBeEmpty()
  91.                     ->defaultValue('Alep\LdapBundle\DataMapper\DefaultLdapUserMapper')
  92.                 ->end()
  93.                 ->scalarNode('logger')
  94.                     ->info('This is the logger service used by the bundle.')
  95.                 ->end()
  96.             ->end()
  97.         ;
  98.         return $treeBuilder;
  99.     }
  100. }