|
19 | 19 | use Symfony\Component\Security\Core\User\UserProviderInterface; |
20 | 20 | use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; |
21 | 21 | use Symfony\Component\Security\Http\Authenticator\Passport\Passport; |
22 | | -use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; |
23 | 22 | use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport; |
24 | 23 |
|
25 | 24 | final class OAuth2AuthenticatorTest extends TestCase |
@@ -132,41 +131,6 @@ public function testAuthenticateCreatePassportWithClientCredentialsUser(): void |
132 | 131 | $this->assertInstanceOf(ClientCredentialsUser::class, $passport->getUser()); |
133 | 132 | } |
134 | 133 |
|
135 | | - /** |
136 | | - * @group legacy |
137 | | - */ |
138 | | - public function testCreateAuthenticatedToken(): void |
139 | | - { |
140 | | - if (!interface_exists(PassportInterface::class)) { |
141 | | - $this->markTestSkipped('Irrelevant on Symfony 6+'); |
142 | | - } |
143 | | - |
144 | | - $userBadge = new UserBadge('oauthClientId', static function (): UserInterface { |
145 | | - return new ClientCredentialsUser('oauthClientId'); |
146 | | - }); |
147 | | - |
148 | | - $passport = new SelfValidatingPassport($userBadge, [ |
149 | | - new ScopeBadge(['scope_one', 'scope_two']), |
150 | | - ]); |
151 | | - $passport->setAttribute('accessTokenId', 'accessTokenId'); |
152 | | - $passport->setAttribute('oauthClientId', 'oauthClientId'); |
153 | | - |
154 | | - $authenticator = new OAuth2Authenticator( |
155 | | - $this->createMock(HttpMessageFactoryInterface::class), |
156 | | - $this->createMock(ResourceServer::class), |
157 | | - $this->createMock(TestUserProvider::class), |
158 | | - 'PREFIX_' |
159 | | - ); |
160 | | - |
161 | | - $token = $authenticator->createAuthenticatedToken($passport, 'firewallName'); |
162 | | - |
163 | | - $this->assertSame(['scope_one', 'scope_two'], $token->getScopes()); |
164 | | - $this->assertSame('accessTokenId', $token->getCredentials()); |
165 | | - $this->assertInstanceOf(ClientCredentialsUser::class, $token->getUser()); |
166 | | - $this->assertSame('oauthClientId', $token->getUser()->getUserIdentifier()); |
167 | | - $this->assertTrue($token->isAuthenticated()); |
168 | | - } |
169 | | - |
170 | 134 | public function testCreateToken(): void |
171 | 135 | { |
172 | 136 | $userBadge = new UserBadge('userIdentifier', static function (): UserInterface { |
|
0 commit comments