|
21 | 21 | use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; |
22 | 22 | use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; |
23 | 23 | use Symfony\Component\Security\Http\Authenticator\Passport\Passport; |
24 | | -use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; |
25 | 24 | use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport; |
26 | 25 | use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; |
27 | 26 |
|
|
30 | 29 | */ |
31 | 30 | final class OAuth2Authenticator implements AuthenticatorInterface, AuthenticationEntryPointInterface |
32 | 31 | { |
33 | | - /** |
34 | | - * @psalm-suppress UndefinedTrait |
35 | | - * @psalm-suppress MethodSignatureMismatch |
36 | | - */ |
37 | | - use ForwardCompatAuthenticatorTrait; |
38 | | - |
39 | 32 | private HttpMessageFactoryInterface $httpMessageFactory; |
40 | 33 | private ResourceServer $resourceServer; |
41 | 34 | private UserProviderInterface $userProvider; |
@@ -63,10 +56,7 @@ public function start(Request $request, ?AuthenticationException $authException |
63 | 56 | return new Response($authException?->getMessage() ?? 'Authentication required', 401, ['WWW-Authenticate' => 'Bearer']); |
64 | 57 | } |
65 | 58 |
|
66 | | - /** |
67 | | - * @return Passport |
68 | | - */ |
69 | | - public function doAuthenticate(Request $request) /* : Passport */ |
| 59 | + public function authenticate(Request $request): Passport |
70 | 60 | { |
71 | 61 | try { |
72 | 62 | $psr7Request = $this->resourceServer->validateAuthenticatedRequest($this->httpMessageFactory->createRequest($request)); |
@@ -105,30 +95,6 @@ public function doAuthenticate(Request $request) /* : Passport */ |
105 | 95 | return $passport; |
106 | 96 | } |
107 | 97 |
|
108 | | - /** |
109 | | - * @return OAuth2Token |
110 | | - * |
111 | | - * @psalm-suppress DeprecatedInterface |
112 | | - * @psalm-suppress UndefinedClass |
113 | | - * @psalm-suppress MixedInferredReturnType |
114 | | - * @psalm-suppress RedundantCondition |
115 | | - */ |
116 | | - public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface |
117 | | - { |
118 | | - if (!$passport instanceof Passport) { |
119 | | - throw new \RuntimeException(\sprintf('Cannot create a OAuth2 authenticated token. $passport should be a %s', Passport::class)); |
120 | | - } |
121 | | - |
122 | | - $token = $this->createToken($passport, $firewallName); |
123 | | - /** |
124 | | - * @psalm-suppress TooManyArguments |
125 | | - * @psalm-suppress UndefinedMethod |
126 | | - */ |
127 | | - $token->setAuthenticated(true); |
128 | | - |
129 | | - return $token; |
130 | | - } |
131 | | - |
132 | 98 | /** |
133 | 99 | * @return OAuth2Token |
134 | 100 | */ |
|
0 commit comments