Skip to content

Commit 216b194

Browse files
Merge branch '4.4' into 5.2
* 4.4: [CI][Psalm] Install stable/released PHPUnit [Security] Add missing Finnish translations [Security][Guard] Prevent user enumeration via response content
2 parents 942b40f + 8188709 commit 216b194

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Authentication/Provider/UserAuthenticationProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
1515
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1616
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
17+
use Symfony\Component\Security\Core\Exception\AccountStatusException;
1718
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1819
use Symfony\Component\Security\Core\Exception\AuthenticationServiceException;
1920
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
@@ -79,7 +80,7 @@ public function authenticate(TokenInterface $token)
7980
$this->userChecker->checkPreAuth($user);
8081
$this->checkAuthentication($user, $token);
8182
$this->userChecker->checkPostAuth($user);
82-
} catch (BadCredentialsException $e) {
83+
} catch (AccountStatusException $e) {
8384
if ($this->hideUserNotFoundExceptions) {
8485
throw new BadCredentialsException('Bad credentials.', 0, $e);
8586
}

Resources/translations/security.fi.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@
7070
<source>Invalid or expired login link.</source>
7171
<target>Virheellinen tai vanhentunut kirjautumislinkki.</target>
7272
</trans-unit>
73+
<trans-unit id="19">
74+
<source>Too many failed login attempts, please try again in %minutes% minute.</source>
75+
<target>Liian monta epäonnistunutta kirjautumisyritystä, yritä uudelleen %minutes% minuutin kuluttua.</target>
76+
</trans-unit>
77+
<trans-unit id="20">
78+
<source>Too many failed login attempts, please try again in %minutes% minutes.</source>
79+
<target>Liian monta epäonnistunutta kirjautumisyritystä, yritä uudelleen %minutes% minuutin kuluttua.</target>
80+
</trans-unit>
7381
</body>
7482
</file>
7583
</xliff>

Tests/Authentication/Provider/UserAuthenticationProviderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testAuthenticateWhenProviderDoesNotReturnAnUserInterface()
8282

8383
public function testAuthenticateWhenPreChecksFails()
8484
{
85-
$this->expectException(CredentialsExpiredException::class);
85+
$this->expectException(BadCredentialsException::class);
8686
$userChecker = $this->createMock(UserCheckerInterface::class);
8787
$userChecker->expects($this->once())
8888
->method('checkPreAuth')
@@ -100,7 +100,7 @@ public function testAuthenticateWhenPreChecksFails()
100100

101101
public function testAuthenticateWhenPostChecksFails()
102102
{
103-
$this->expectException(AccountExpiredException::class);
103+
$this->expectException(BadCredentialsException::class);
104104
$userChecker = $this->createMock(UserCheckerInterface::class);
105105
$userChecker->expects($this->once())
106106
->method('checkPostAuth')
@@ -127,7 +127,7 @@ public function testAuthenticateWhenPostCheckAuthenticationFails()
127127
;
128128
$provider->expects($this->once())
129129
->method('checkAuthentication')
130-
->willThrowException(new BadCredentialsException())
130+
->willThrowException(new CredentialsExpiredException())
131131
;
132132

133133
$provider->authenticate($this->getSupportedToken());

0 commit comments

Comments
 (0)