Skip to content

Commit 2eaa41a

Browse files
authored
Update access_token.rst
1 parent f6a583c commit 2eaa41a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

security/access_token.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ using a fictive Doctrine repository.
6363
{
6464
}
6565
66-
public function getUserIdentifierFrom(string $token): string
66+
public function getUserIdentifierFrom(string $accessToken): string
6767
{
6868
// The handler tries to find the access token.
69-
$accessToken = $this->repository->findOneByValue($token);
69+
$token = $this->repository->findOneByValue($accessToken);
7070
7171
// 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()) {
7373
throw new BadCredentialsException('Invalid credentials.');
7474
}
7575
7676
// The access token is valid, the handler returned the associated user ID.
77-
return $accessToken->getUserId();
77+
return $token->getUserId();
7878
}
7979
}
8080
@@ -140,7 +140,7 @@ Customizing the Authenticators
140140

141141
You can define a specific extractor by creating a service that implements the interface
142142
:class:``Symfony\Component\Security\Http\Authenticator\AccessToken\AccessTokenExtractorInterface``::.
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
144144
if any or ``null`` otherwise.
145145

146146
.. configuration-block::
@@ -154,9 +154,9 @@ if any or ``null`` otherwise.
154154
155155
class CustomExtractor implements AccessTokenExtractorInterface
156156
{
157-
public function extractToken(Request $request): ?string
157+
public function extractAccessToken(Request $request): ?string
158158
{
159-
... // Extract the token from the request object or return null
159+
... // Extract the access token from the request object or return null
160160
}
161161
}
162162

0 commit comments

Comments
 (0)