diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2013-09-16 14:00:03 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2013-09-23 09:15:09 +0200 |
commit | 76e8abad8efbc5a988c1aa566b072d62e083faa9 (patch) | |
tree | a38a749cd872a39216b3eaf6f51b752280f320ae /Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php | |
parent | 38c5dd30d7545490836456062abf49c213b972cb (diff) | |
download | symfony-security-76e8abad8efbc5a988c1aa566b072d62e083faa9.zip symfony-security-76e8abad8efbc5a988c1aa566b072d62e083faa9.tar.gz symfony-security-76e8abad8efbc5a988c1aa566b072d62e083faa9.tar.bz2 |
[Security] limited the password length passed to encoders
Diffstat (limited to 'Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php')
-rw-r--r-- | Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php b/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php index ba5c4d5..4991330 100644 --- a/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php +++ b/Core/Tests/Encoder/Pbkdf2PasswordEncoderTest.php @@ -42,4 +42,24 @@ class Pbkdf2PasswordEncoderTest extends \PHPUnit_Framework_TestCase $encoder = new Pbkdf2PasswordEncoder('foobar'); $encoder->encodePassword('password', ''); } + + /** + * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException + */ + public function testEncodePasswordLength() + { + $encoder = new Pbkdf2PasswordEncoder(); + + $encoder->encodePassword(str_repeat('a', 5000), 'salt'); + } + + /** + * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException + */ + public function testCheckPasswordLength() + { + $encoder = new Pbkdf2PasswordEncoder(); + + $encoder->isPasswordValid('encoded', str_repeat('a', 5000), 'salt'); + } } |