File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Tests/Authentication/Provider Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 14
14
use Symfony \Component \Security \Core \Authentication \Token \SwitchUserToken ;
15
15
use Symfony \Component \Security \Core \Authentication \Token \TokenInterface ;
16
16
use Symfony \Component \Security \Core \Authentication \Token \UsernamePasswordToken ;
17
+ use Symfony \Component \Security \Core \Exception \AccountStatusException ;
17
18
use Symfony \Component \Security \Core \Exception \AuthenticationException ;
18
19
use Symfony \Component \Security \Core \Exception \AuthenticationServiceException ;
19
20
use Symfony \Component \Security \Core \Exception \BadCredentialsException ;
@@ -80,7 +81,7 @@ public function authenticate(TokenInterface $token)
80
81
$ this ->userChecker ->checkPreAuth ($ user );
81
82
$ this ->checkAuthentication ($ user , $ token );
82
83
$ this ->userChecker ->checkPostAuth ($ user );
83
- } catch (BadCredentialsException $ e ) {
84
+ } catch (AccountStatusException $ e ) {
84
85
if ($ this ->hideUserNotFoundExceptions ) {
85
86
throw new BadCredentialsException ('Bad credentials. ' , 0 , $ e );
86
87
}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public function testAuthenticateWhenProviderDoesNotReturnAnUserInterface()
83
83
84
84
public function testAuthenticateWhenPreChecksFails ()
85
85
{
86
- $ this ->expectException (CredentialsExpiredException ::class);
86
+ $ this ->expectException (BadCredentialsException ::class);
87
87
$ userChecker = $ this ->createMock (UserCheckerInterface::class);
88
88
$ userChecker ->expects ($ this ->once ())
89
89
->method ('checkPreAuth ' )
@@ -101,7 +101,7 @@ public function testAuthenticateWhenPreChecksFails()
101
101
102
102
public function testAuthenticateWhenPostChecksFails ()
103
103
{
104
- $ this ->expectException (AccountExpiredException ::class);
104
+ $ this ->expectException (BadCredentialsException ::class);
105
105
$ userChecker = $ this ->createMock (UserCheckerInterface::class);
106
106
$ userChecker ->expects ($ this ->once ())
107
107
->method ('checkPostAuth ' )
@@ -128,7 +128,7 @@ public function testAuthenticateWhenPostCheckAuthenticationFails()
128
128
;
129
129
$ provider ->expects ($ this ->once ())
130
130
->method ('checkAuthentication ' )
131
- ->willThrowException (new BadCredentialsException ())
131
+ ->willThrowException (new CredentialsExpiredException ())
132
132
;
133
133
134
134
$ provider ->authenticate ($ this ->getSupportedToken ());
You can’t perform that action at this time.
0 commit comments