| Conditions | 1 |
| Paths | 1 |
| Total Lines | 81 |
| Code Lines | 77 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 188 | protected function addSecuritySection(ArrayNodeDefinition $node) |
||
| 189 | { |
||
| 190 | $node |
||
| 191 | ->children() |
||
| 192 | ->arrayNode('security') |
||
| 193 | ->addDefaultsIfNotSet() |
||
| 194 | ->children() |
||
| 195 | ->scalarNode('search_base')->defaultNull() |
||
| 196 | ->info('The default DN to start the user search from.')->end() |
||
| 197 | ->scalarNode('ldap_object_type')->defaultValue('user') |
||
| 198 | ->info('The LdapTools object type for the user provider to search for.')->end() |
||
| 199 | ->scalarNode('default_role')->defaultValue('ROLE_USER') |
||
| 200 | ->info('Regardless of group membership this role will be assigned to the loaded user. Set it to null for no roles to be assigned by default.')->end() |
||
| 201 | ->scalarNode('login_query_attribute')->defaultNull() |
||
| 202 | ->info('If set the guard/authenticator will query LDAP for for a user with this attribute value using the username provided during login. The resulting user DN will be used to bind to LDAP.')->end() |
||
| 203 | ->booleanNode('check_groups_recursively') |
||
| 204 | ->info('If set to true then group membership will contain all groups, and nested groups, the user belongs to.')->defaultTrue()->end() |
||
| 205 | ->scalarNode('user')->defaultValue('\LdapTools\Bundle\LdapToolsBundle\Security\User\LdapUser') |
||
| 206 | ->info('The user class that the LDAP user provider will instantiate. It must implement the LdapUserInterface.')->end() |
||
| 207 | ->arrayNode('guard') |
||
| 208 | ->info('Guard specific configuration options.') |
||
| 209 | ->addDefaultsIfNotSet() |
||
| 210 | ->children() |
||
| 211 | ->booleanNode('http_basic')->defaultFalse()->end() |
||
| 212 | ->scalarNode('http_basic_domain')->defaultNull()->end() |
||
| 213 | ->scalarNode('http_basic_realm')->defaultNull()->end() |
||
| 214 | ->scalarNode('login_path')->defaultValue('/login')->end() |
||
| 215 | ->scalarNode('default_target_path')->defaultValue('/')->end() |
||
| 216 | ->booleanNode('always_use_target_path')->defaultFalse()->end() |
||
| 217 | ->scalarNode('target_path_parameter')->defaultValue('_target_path')->end() |
||
| 218 | ->booleanNode('use_referer')->defaultFalse()->end() |
||
| 219 | ->scalarNode('failure_path')->defaultNull()->end() |
||
| 220 | ->booleanNode('failure_forward')->defaultFalse()->end() |
||
| 221 | ->scalarNode('failure_path_parameter')->defaultValue('_failure_path')->end() |
||
| 222 | ->scalarNode('username_parameter')->defaultValue('_username')->end() |
||
| 223 | ->scalarNode('password_parameter')->defaultValue('_password')->end() |
||
| 224 | ->scalarNode('domain_parameter')->defaultValue('_ldap_domain')->end() |
||
| 225 | ->booleanNode('use_forward')->defaultFalse()->end() |
||
| 226 | ->booleanNode('post_only')->defaultFalse()->end() |
||
| 227 | ->booleanNode('remember_me')->defaultFalse()->end() |
||
| 228 | ->end() |
||
| 229 | ->end() |
||
| 230 | ->arrayNode('additional_attributes') |
||
| 231 | ->info('Any additional attribute values that should be available when the user is loaded.') |
||
| 232 | ->prototype('scalar')->end() |
||
| 233 | ->end() |
||
| 234 | ->arrayNode('roles') |
||
| 235 | ->info('Map LDAP group names to specific roles. If a user is a member of the group they will get the role mapped to it.') |
||
| 236 | ->useAttributeAsKey('name') |
||
| 237 | ->prototype('array') |
||
| 238 | ->beforeNormalization() |
||
| 239 | ->ifTrue(function ($v) { |
||
| 240 | return !is_array($v); |
||
| 241 | }) |
||
| 242 | ->then(function ($v) { |
||
| 243 | return [$v]; |
||
| 244 | }) |
||
| 245 | ->end() |
||
| 246 | ->prototype('scalar')->end() |
||
| 247 | ->end() |
||
| 248 | ->end() |
||
| 249 | ->scalarNode('role_ldap_type')->defaultValue('group') |
||
| 250 | ->info('The LdapTools object type for the groups used to check for roles.')->end() |
||
| 251 | ->arrayNode('role_attributes') |
||
| 252 | ->info('When searching for groups/roles for a user, map to these attributes for GUID, SID, members, or name.') |
||
| 253 | ->addDefaultsIfNotSet() |
||
| 254 | ->children() |
||
| 255 | ->scalarNode('name')->defaultValue('name')->end() |
||
| 256 | ->scalarNode('sid')->defaultValue('sid')->end() |
||
| 257 | ->scalarNode('guid')->defaultValue('guid')->end() |
||
| 258 | ->scalarNode('members')->defaultValue('members')->end() |
||
| 259 | ->end() |
||
| 260 | ->end() |
||
| 261 | ->booleanNode('refresh_user_attributes') |
||
| 262 | ->info('Set this to true if you want user attributes re-queried on a user refresh.')->defaultFalse()->end() |
||
| 263 | ->booleanNode('refresh_user_roles') |
||
| 264 | ->info('Set this to true if you want user roles re-queried on a user refresh.')->defaultFalse()->end() |
||
| 265 | ->end() |
||
| 266 | ->end() |
||
| 267 | ->end(); |
||
| 268 | } |
||
| 269 | } |
||
| 270 |