@@ -63,18 +63,18 @@ using a fictive Doctrine repository.
63
63
{
64
64
}
65
65
66
- public function getUserIdentifierFrom(string $token ): string
66
+ public function getUserIdentifierFrom(string $accessToken ): string
67
67
{
68
68
// The handler tries to find the access token.
69
- $accessToken = $this->repository->findOneByValue($token );
69
+ $token = $this->repository->findOneByValue($accessToken );
70
70
71
71
// If no access token is found or if it expired, the handler throws and exception.
72
- if ($accessToken === null || !$accessToken ->isValid()) {
72
+ if ($token === null || !$token ->isValid()) {
73
73
throw new BadCredentialsException('Invalid credentials.');
74
74
}
75
75
76
76
// The access token is valid, the handler returned the associated user ID.
77
- return $accessToken ->getUserId();
77
+ return $token ->getUserId();
78
78
}
79
79
}
80
80
@@ -140,7 +140,7 @@ Customizing the Authenticators
140
140
141
141
You can define a specific extractor by creating a service that implements the interface
142
142
:class: ``Symfony\C omponent\S ecurity\H ttp\A uthenticator\A ccessToken\A ccessTokenExtractorInterface` `::.
143
- This interface has a unique method ``extractToken (Request $request): ?string `` and shall return the access token
143
+ This interface has a unique method ``extractAccessToken (Request $request): ?string `` and shall return the access token
144
144
if any or ``null `` otherwise.
145
145
146
146
.. configuration-block ::
@@ -154,9 +154,9 @@ if any or ``null`` otherwise.
154
154
155
155
class CustomExtractor implements AccessTokenExtractorInterface
156
156
{
157
- public function extractToken (Request $request): ?string
157
+ public function extractAccessToken (Request $request): ?string
158
158
{
159
- ... // Extract the token from the request object or return null
159
+ ... // Extract the access token from the request object or return null
160
160
}
161
161
}
162
162
0 commit comments