File tree 6 files changed +20
-17
lines changed
Filter options
src/Symfony/Component/Security
6 files changed +20
-17
lines changed
Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ Routing
91
91
Security
92
92
--------
93
93
94
+ * [ BC BREAK] Remove method ` checkIfCompletelyResolved() ` from ` PassportInterface ` , checking that passport badges are
95
+ resolved is up to ` AuthenticatorManager `
94
96
* Deprecate class ` User ` , use ` InMemoryUser ` or your own implementation instead.
95
97
If you are using the ` isAccountNonLocked() ` , ` isAccountNonExpired() ` or ` isCredentialsNonExpired() ` method, consider re-implementing
96
98
them in your own user class, as they are not part of the ` InMemoryUser ` API
Original file line number Diff line number Diff line change 53
53
"symfony/polyfill-php73" : " ^1.11" ,
54
54
"symfony/polyfill-php80" : " ^1.15" ,
55
55
"symfony/polyfill-uuid" : " ^1.15" ,
56
- "symfony/runtime" : " self.version"
56
+ "symfony/runtime" : " self.version" ,
57
+ "vimeo/psalm" : " 4.x-dev"
57
58
},
58
59
"replace" : {
59
60
"symfony/asset" : " self.version" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ CHANGELOG
4
4
5.3
5
5
---
6
6
7
+ * Add ` PassportInterface:getBadges() ` , implemented by ` PassportTrait `
8
+ * [ BC BREAK] Remove method ` checkIfCompletelyResolved() ` from ` PassportInterface ` , checking that passport badges are
9
+ resolved is up to ` AuthenticatorManager `
7
10
* Deprecate class ` User ` , use ` InMemoryUser ` instead
8
11
* Deprecate class ` UserChecker ` , use ` InMemoryUserChecker ` or your own implementation instead
9
12
* [ BC break] Remove support for passing a ` UserInterface ` implementation to ` Passport ` , use the ` UserBadge ` instead.
Original file line number Diff line number Diff line change 19
19
use Symfony \Component \Security \Core \AuthenticationEvents ;
20
20
use Symfony \Component \Security \Core \Event \AuthenticationSuccessEvent ;
21
21
use Symfony \Component \Security \Core \Exception \AuthenticationException ;
22
+ use Symfony \Component \Security \Core \Exception \BadCredentialsException ;
22
23
use Symfony \Component \Security \Core \User \UserInterface ;
23
24
use Symfony \Component \Security \Http \Authenticator \AuthenticatorInterface ;
24
25
use Symfony \Component \Security \Http \Authenticator \InteractiveAuthenticatorInterface ;
@@ -168,7 +169,11 @@ private function executeAuthenticator(AuthenticatorInterface $authenticator, Req
168
169
$ this ->eventDispatcher ->dispatch ($ event );
169
170
170
171
// check if all badges are resolved
171
- $ passport ->checkIfCompletelyResolved ();
172
+ foreach ($ passport ->getBadges () as $ badge ) {
173
+ if (!$ badge ->isResolved ()) {
174
+ throw new BadCredentialsException (sprintf ('Authentication failed: Security badge "%s" is not resolved, did you forget to register the correct listeners? ' , get_debug_type ($ badge )));
175
+ }
176
+ }
172
177
173
178
// create the authenticated token
174
179
$ authenticatedToken = $ authenticator ->createAuthenticatedToken ($ passport , $ this ->firewallName );
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \Security \Http \Authenticator \Passport ;
13
13
14
- use Symfony \Component \Security \Core \Exception \BadCredentialsException ;
15
14
use Symfony \Component \Security \Http \Authenticator \Passport \Badge \BadgeInterface ;
16
15
17
16
/**
@@ -43,9 +42,7 @@ public function hasBadge(string $badgeFqcn): bool;
43
42
public function getBadge (string $ badgeFqcn ): ?BadgeInterface ;
44
43
45
44
/**
46
- * Checks if all badges are marked as resolved.
47
- *
48
- * @throws BadCredentialsException when a badge is not marked as resolved
45
+ * @return array<class-string<BadgeInterface>, BadgeInterface> An array of badge instances indexed by class name
49
46
*/
50
- public function checkIfCompletelyResolved (): void ;
47
+ public function getBadges (): array ;
51
48
}
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \Security \Http \Authenticator \Passport ;
13
13
14
- use Symfony \Component \Security \Core \Exception \BadCredentialsException ;
15
14
use Symfony \Component \Security \Http \Authenticator \Passport \Badge \BadgeInterface ;
16
15
17
16
/**
21
20
*/
22
21
trait PassportTrait
23
22
{
24
- /**
25
- * @var BadgeInterface[]
26
- */
27
23
private $ badges = [];
28
24
29
25
public function addBadge (BadgeInterface $ badge ): PassportInterface
@@ -43,12 +39,11 @@ public function getBadge(string $badgeFqcn): ?BadgeInterface
43
39
return $ this ->badges [$ badgeFqcn ] ?? null ;
44
40
}
45
41
46
- public function checkIfCompletelyResolved (): void
42
+ /**
43
+ * @return array<class-string<BadgeInterface>, BadgeInterface>
44
+ */
45
+ public function getBadges (): array
47
46
{
48
- foreach ($ this ->badges as $ badge ) {
49
- if (!$ badge ->isResolved ()) {
50
- throw new BadCredentialsException (sprintf ('Authentication failed security badge "%s" is not resolved, did you forget to register the correct listeners? ' , \get_class ($ badge )));
51
- }
52
- }
47
+ return $ this ->badges ;
53
48
}
54
49
}
You can’t perform that action at this time.
0 commit comments