Skip to content

Commit c83546d

Browse files
committed
[Security] tweaked previous commit
1 parent b2e553a commit c83546d

File tree

6 files changed

+27
-38
lines changed

6 files changed

+27
-38
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"symfony/icu": "~1.0",
2121
"doctrine/common": "~2.2",
2222
"twig/twig": "~1.11",
23-
"psr/log": "~1.0",
24-
"ircmaxell/password-compat": "1.0.*"
23+
"psr/log": "~1.0"
2524
},
2625
"replace": {
2726
"symfony/browser-kit": "self.version",
@@ -66,7 +65,8 @@
6665
"doctrine/dbal": "~2.2",
6766
"doctrine/orm": "~2.2,>=2.2.3",
6867
"monolog/monolog": "~1.3",
69-
"propel/propel1": "1.6.*"
68+
"propel/propel1": "1.6.*",
69+
"ircmaxell/password-compat": "1.0.*"
7070
},
7171
"autoload": {
7272
"psr-0": { "Symfony\\": "src/" },

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -452,42 +452,33 @@ private function createEncoder($config, ContainerBuilder $container)
452452

453453
// pbkdf2 encoder
454454
if ('pbkdf2' === $config['algorithm']) {
455-
$arguments = array(
456-
$config['hash_algorithm'],
457-
$config['encode_as_base64'],
458-
$config['iterations'],
459-
$config['key_length'],
460-
);
461-
462455
return array(
463-
'class' => new Parameter('security.encoder.pbkdf2.class'),
464-
'arguments' => $arguments,
456+
'class' => new Parameter('security.encoder.pbkdf2.class'),
457+
'arguments' => array(
458+
$config['hash_algorithm'],
459+
$config['encode_as_base64'],
460+
$config['iterations'],
461+
$config['key_length'],
462+
),
465463
);
466464
}
467465

468466
// bcrypt encoder
469467
if ('bcrypt' === $config['algorithm']) {
470-
$arguments = array(
471-
new Reference('security.secure_random'),
472-
$config['cost'],
473-
);
474-
475468
return array(
476-
'class' => new Parameter('security.encoder.bcrypt.class'),
477-
'arguments' => $arguments,
469+
'class' => new Parameter('security.encoder.bcrypt.class'),
470+
'arguments' => array($config['cost']),
478471
);
479472
}
480473

481474
// message digest encoder
482-
$arguments = array(
483-
$config['algorithm'],
484-
$config['encode_as_base64'],
485-
$config['iterations'],
486-
);
487-
488475
return array(
489-
'class' => new Parameter('security.encoder.digest.class'),
490-
'arguments' => $arguments,
476+
'class' => new Parameter('security.encoder.digest.class'),
477+
'arguments' => array(
478+
$config['algorithm'],
479+
$config['encode_as_base64'],
480+
$config['iterations'],
481+
),
491482
);
492483
}
493484

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,7 @@ public function testEncoders()
160160
),
161161
'JMS\FooBundle\Entity\User6' => array(
162162
'class' => new Parameter('security.encoder.bcrypt.class'),
163-
'arguments' => array(
164-
new Reference('security.secure_random'),
165-
15,
166-
)
163+
'arguments' => array(15),
167164
),
168165
)), $container->getDefinition('security.encoder_factory.generic')->getArguments());
169166
}

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ CHANGELOG
44
2.3.0
55
-----
66

7+
* [BC BREAK] the BCrypt encoder constructor signature has changed (the first argument was removed)
78
* added RequestContext::getQueryString()
89

910
2.2.0
1011
-----
1112

13+
* Added BCrypt password encoder
1214
* [DEPRECATION] Several route settings have been renamed (the old ones will be removed in 3.0):
1315

1416
* The `pattern` setting for a route has been deprecated in favor of `path`

src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ public function __construct($cost)
4646
*/
4747
public function encodePassword($raw, $salt)
4848
{
49-
return password_hash($raw, PASSWORD_BCRYPT, array(
50-
'cost' => $this->cost,
51-
));
49+
return password_hash($raw, PASSWORD_BCRYPT, array('cost' => $this->cost));
5250
}
5351

5452
/**

src/Symfony/Component/Security/composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,25 @@
1919
"php": ">=5.3.3",
2020
"symfony/event-dispatcher": "~2.1",
2121
"symfony/http-foundation": ">=2.1,<2.4-dev",
22-
"symfony/http-kernel": ">=2.1,<=2.3-dev",
23-
"ircmaxell/password-compat": "1.0.*"
22+
"symfony/http-kernel": ">=2.1,<=2.3-dev"
2423
},
2524
"require-dev": {
2625
"symfony/form": "~2.0",
2726
"symfony/routing": ">=2.2,<2.4-dev",
2827
"symfony/validator": ">=2.2,<2.4-dev",
2928
"doctrine/common": "~2.2",
3029
"doctrine/dbal": "~2.2",
31-
"psr/log": "~1.0"
30+
"psr/log": "~1.0",
31+
"ircmaxell/password-compat": "1.0.*"
3232
},
3333
"suggest": {
3434
"symfony/class-loader": "2.2.*",
3535
"symfony/finder": "2.2.*",
3636
"symfony/form": "2.2.*",
3737
"symfony/validator": "2.2.*",
3838
"symfony/routing": "2.2.*",
39-
"doctrine/dbal": "to use the built-in ACL implementation"
39+
"doctrine/dbal": "to use the built-in ACL implementation",
40+
"ircmaxell/password-compat": "1.0.*"
4041
},
4142
"autoload": {
4243
"psr-0": { "Symfony\\Component\\Security\\": "" }

0 commit comments

Comments
 (0)