diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2013-10-10 08:30:51 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2013-10-10 14:05:52 +0200 |
commit | 41cbe3694a5332d7e5bdb285c81bbfe23f31a220 (patch) | |
tree | 48b09420b041421ce1ee3e35d21d98ab11e7d793 /Tests/Core/Encoder/MessageDigestPasswordEncoderTest.php | |
parent | e3a08775fbfb1062167a56e3c5f606b3300d40a8 (diff) | |
download | symfony-security-41cbe3694a5332d7e5bdb285c81bbfe23f31a220.zip symfony-security-41cbe3694a5332d7e5bdb285c81bbfe23f31a220.tar.gz symfony-security-41cbe3694a5332d7e5bdb285c81bbfe23f31a220.tar.bz2 |
[Security] limited the password length passed to encodersv2.2.9
Diffstat (limited to 'Tests/Core/Encoder/MessageDigestPasswordEncoderTest.php')
-rw-r--r-- | Tests/Core/Encoder/MessageDigestPasswordEncoderTest.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/Core/Encoder/MessageDigestPasswordEncoderTest.php b/Tests/Core/Encoder/MessageDigestPasswordEncoderTest.php index 64032c4..117b8ba 100644 --- a/Tests/Core/Encoder/MessageDigestPasswordEncoderTest.php +++ b/Tests/Core/Encoder/MessageDigestPasswordEncoderTest.php @@ -42,4 +42,21 @@ class MessageDigestPasswordEncoderTest extends \PHPUnit_Framework_TestCase $encoder = new MessageDigestPasswordEncoder('foobar'); $encoder->encodePassword('password', ''); } + + /** + * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException + */ + public function testEncodePasswordLength() + { + $encoder = new MessageDigestPasswordEncoder(); + + $encoder->encodePassword(str_repeat('a', 5000), 'salt'); + } + + public function testCheckPasswordLength() + { + $encoder = new MessageDigestPasswordEncoder(); + + $this->assertFalse($encoder->isPasswordValid('encoded', str_repeat('a', 5000), 'salt')); + } } |