Permalink
Browse files

[Security] tweaked previous commit

  • Loading branch information...
1 parent 4d0d663 commit e22e111027f80ff3f74f2039e2e56e2dc73c863e @fabpot fabpot committed Apr 25, 2013
Showing with 16 additions and 28 deletions.
  1. +15 −24 DependencyInjection/SecurityExtension.php
  2. +1 −4 Tests/DependencyInjection/SecurityExtensionTest.php
@@ -452,42 +452,33 @@ private function createEncoder($config, ContainerBuilder $container)
// pbkdf2 encoder
if ('pbkdf2' === $config['algorithm']) {
- $arguments = array(
- $config['hash_algorithm'],
- $config['encode_as_base64'],
- $config['iterations'],
- $config['key_length'],
- );
-
return array(
- 'class' => new Parameter('security.encoder.pbkdf2.class'),
- 'arguments' => $arguments,
+ 'class' => new Parameter('security.encoder.pbkdf2.class'),
+ 'arguments' => array(
+ $config['hash_algorithm'],
+ $config['encode_as_base64'],
+ $config['iterations'],
+ $config['key_length'],
+ ),
);
}
// bcrypt encoder
if ('bcrypt' === $config['algorithm']) {
- $arguments = array(
- new Reference('security.secure_random'),
- $config['cost'],
- );
-
return array(
- 'class' => new Parameter('security.encoder.bcrypt.class'),
- 'arguments' => $arguments,
+ 'class' => new Parameter('security.encoder.bcrypt.class'),
+ 'arguments' => array($config['cost']),
);
}
// message digest encoder
- $arguments = array(
- $config['algorithm'],
- $config['encode_as_base64'],
- $config['iterations'],
- );
-
return array(
- 'class' => new Parameter('security.encoder.digest.class'),
- 'arguments' => $arguments,
+ 'class' => new Parameter('security.encoder.digest.class'),
+ 'arguments' => array(
+ $config['algorithm'],
+ $config['encode_as_base64'],
+ $config['iterations'],
+ ),
);
}
@@ -160,10 +160,7 @@ public function testEncoders()
),
'JMS\FooBundle\Entity\User6' => array(
'class' => new Parameter('security.encoder.bcrypt.class'),
- 'arguments' => array(
- new Reference('security.secure_random'),
- 15,
- )
+ 'arguments' => array(15),
),
)), $container->getDefinition('security.encoder_factory.generic')->getArguments());
}

0 comments on commit e22e111

Please sign in to comment.